Showing
5 changed files
with
162 additions
and
0 deletions
@@ -39,9 +39,55 @@ iconfont 新建项目,使用 class 控制图标样式,不要用 unicode<br> | @@ -39,9 +39,55 @@ iconfont 新建项目,使用 class 控制图标样式,不要用 unicode<br> | ||
39 | <button class="button button-large button-round button-solid">大,圆角,实心</button> | 39 | <button class="button button-large button-round button-solid">大,圆角,实心</button> |
40 | 40 | ||
41 | <h2>badge</h2> | 41 | <h2>badge</h2> |
42 | +<a style="position:relative"><i class="icon icon-bag"></i><span class="badge badge-tr">1</span></a> | ||
43 | +<a style="position:relative"><i class="icon icon-bag"></i><span class="badge">99</span></a> | ||
44 | +<br> | ||
42 | 一个数字的时候是圆形,数字长的时候圆角长方形,类似跑道 | 45 | 一个数字的时候是圆形,数字长的时候圆角长方形,类似跑道 |
43 | 46 | ||
44 | <h2>checkbox</h2> | 47 | <h2>checkbox</h2> |
48 | + | ||
49 | +<div class="checkbox"> | ||
50 | + <input type="checkbox" id="check1"> | ||
51 | + <label class="checkbox" for="check1">初始状态</label> | ||
52 | +</div> | ||
53 | +<div class="checkbox"> | ||
54 | + <input type="checkbox" id="check2" checked> | ||
55 | + <label class="checkbox" for="check2">选中状态</label> | ||
56 | +</div> | ||
57 | +<div class="checkbox"> | ||
58 | + <input type="checkbox" id="check3" disabled> | ||
59 | + <label class="checkbox" for="check3">disabled状态</label> | ||
60 | +</div> | ||
61 | +<div class="checkbox"> | ||
62 | + <input type="checkbox" id="check4" disabled checked> | ||
63 | + <label class="checkbox" for="check4">disabled选中状态</label> | ||
64 | +</div> | ||
65 | +<br> | ||
66 | +<div class="radio"> | ||
67 | + <input type="radio" id="radio1"> | ||
68 | + <label for="radio1">初始状态</label> | ||
69 | +</div> | ||
70 | +<div class="radio"> | ||
71 | + <input type="radio" id="radio2" checked> | ||
72 | + <label for="radio2" >选中状态</label> | ||
73 | +</div> | ||
74 | +<div class="radio"> | ||
75 | + <input type="radio" id="radio3" disabled> | ||
76 | + <label for="radio3">disabled状态</label> | ||
77 | +</div> | ||
78 | +<div class="radio"> | ||
79 | + <input type="radio" id="radio4" disabled checked> | ||
80 | + <label for="radio4">disabled选中状态</label> | ||
81 | +</div> | ||
82 | +<br> | ||
83 | +<div class="switch"> | ||
84 | + <input type="checkbox" id="switch1"> | ||
85 | + <label for="switch1"></label> | ||
86 | +</div> | ||
87 | + | ||
88 | + | ||
89 | + | ||
90 | + | ||
45 | 单选,多选,开关,选中不选中。 | 91 | 单选,多选,开关,选中不选中。 |
46 | 纯 CSS 实现,不能依赖 JS,原理参考 http://forsigner.com/magic-check/ | 92 | 纯 CSS 实现,不能依赖 JS,原理参考 http://forsigner.com/magic-check/ |
47 | 93 |
@@ -54,6 +54,7 @@ | @@ -54,6 +54,7 @@ | ||
54 | "gulp-postcss": "^6.1.0", | 54 | "gulp-postcss": "^6.1.0", |
55 | "gulp-sourcemaps": "^2.0.0-alpha", | 55 | "gulp-sourcemaps": "^2.0.0-alpha", |
56 | "gulp-util": "^3.0.7", | 56 | "gulp-util": "^3.0.7", |
57 | + "handlebars": "^4.0.5", | ||
57 | "handlebars-loader": "^1.3.0", | 58 | "handlebars-loader": "^1.3.0", |
58 | "husky": "^0.11.4", | 59 | "husky": "^0.11.4", |
59 | "nodemon": "1.9.2", | 60 | "nodemon": "1.9.2", |
public/scss/common/_badge.css
0 → 100644
1 | +.badge { | ||
2 | + min-width: 16px; | ||
3 | + padding: 3px 7px; | ||
4 | + border-radius: 10px; | ||
5 | + font-size: 14px; | ||
6 | + line-height: 1; | ||
7 | + text-align: center; | ||
8 | + white-space: nowrap; | ||
9 | + | ||
10 | + background-color: $blue; | ||
11 | + color: $white; | ||
12 | +} | ||
13 | + | ||
14 | +/* position */ | ||
15 | +.badge-tr { | ||
16 | + position: absolute; | ||
17 | + top: -5px; | ||
18 | + right: -11px; | ||
19 | +} |
public/scss/common/_form.css
0 → 100644
1 | +.checkbox, | ||
2 | +.radio { | ||
3 | + position: relative; | ||
4 | + display: inline-block; | ||
5 | + | ||
6 | + label { | ||
7 | + padding-left: 33px; | ||
8 | + &:before { | ||
9 | + z-index: 8; | ||
10 | + border: 2px solid $black; | ||
11 | + content: ""; | ||
12 | + } | ||
13 | + &:after { | ||
14 | + position: absolute; | ||
15 | + top: 6px; | ||
16 | + left: 12px; | ||
17 | + z-index: 9; | ||
18 | + display: none; | ||
19 | + content: ""; | ||
20 | + width: 8px; | ||
21 | + height: 16px; | ||
22 | + transform: rotate(45deg); | ||
23 | + border: 2px solid $white; | ||
24 | + border-top: 0; | ||
25 | + border-left: 0; | ||
26 | + } | ||
27 | + } | ||
28 | + | ||
29 | + label:before, | ||
30 | + input { | ||
31 | + position: absolute; | ||
32 | + top: 0; | ||
33 | + left: 0; | ||
34 | + width: 30px; | ||
35 | + height: 30px; | ||
36 | + } | ||
37 | + input { | ||
38 | + z-index: 10; | ||
39 | + opacity: 0; | ||
40 | + } | ||
41 | + | ||
42 | + /* when checked */ | ||
43 | + input:checked { | ||
44 | + ~ label:before { | ||
45 | + background: $black; | ||
46 | + } | ||
47 | + ~ label:after { | ||
48 | + display: block; | ||
49 | + } | ||
50 | + } | ||
51 | + | ||
52 | + /* when disabled */ | ||
53 | + input:disabled { | ||
54 | + ~ label { | ||
55 | + color: #ccc; | ||
56 | + } | ||
57 | + ~ label:before { | ||
58 | + border-color: #e4e4e4; | ||
59 | + } | ||
60 | + &:checked { | ||
61 | + ~ label:before { | ||
62 | + background-color: #e4e4e4; | ||
63 | + } | ||
64 | + } | ||
65 | + } | ||
66 | +} | ||
67 | + | ||
68 | +.radio { | ||
69 | + label:before { | ||
70 | + border-radius: 50%; | ||
71 | + } | ||
72 | + | ||
73 | +} | ||
74 | + | ||
75 | +.switch { | ||
76 | + display: inline-block; | ||
77 | + input { | ||
78 | + display: none; | ||
79 | + } | ||
80 | + label { | ||
81 | + position: relative; | ||
82 | + display: block; | ||
83 | + width: 54px; | ||
84 | + height: 34px; | ||
85 | + background-color: $white; | ||
86 | + border: 1px solid #ddd; | ||
87 | + border-radius: 99999px; | ||
88 | + transition: 0.3s; | ||
89 | + | ||
90 | + &:after { | ||
91 | + content: ""; | ||
92 | + } | ||
93 | + } | ||
94 | +} |
-
Please register or login to post a comment