switch.less
2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
@switch-prefix-cls: ~"@{css-prefix}switch";
.@{switch-prefix-cls} {
display: inline-block;
width: 48px;
height: 24px;
line-height: 22px;
border-radius: 24px;
vertical-align: middle;
border: 1px solid #ccc;
background-color: #ccc;
position: relative;
cursor: pointer;
user-select: none;
.transition(all @transition-time @ease-in-out);
&-inner {
color: #fff;
font-size: @font-size-small;
position: absolute;
left: 25px;
i{
width: 12px;
height: 12px;
text-align: center;
}
}
&:after {
content: '';
width: 20px;
height: 20px;
border-radius: 20px;
background-color: #fff;
position: absolute;
left: 1px;
top: 1px;
cursor: pointer;
.transition2(left @transition-time @ease-in-out, width @transition-time @ease-in-out);
}
&:active:after {
width: 26px;
}
&:focus {
box-shadow: 0 0 0 2px fade(@primary-color, 20%);
outline: 0;
}
&:focus:hover {
box-shadow: none;
}
&-small {
width: 24px;
height: 12px;
line-height: 10px;
&:after {
width: 10px;
height: 10px;
top: 0;
left: 0;
}
&:active:after {
width: 14px;
}
}
&-small&-checked:after {
left: 12px;
}
&-small:active&-checked:after {
left: 8px;
}
&-large{
width: 60px;
&:active:after {
width: 26px;
}
}
&-large:active:after {
width: 32px;
}
&-large&-checked:after {
left: 37px;
}
&-large:active&-checked:after {
left: 25px;
}
&-checked {
border-color: @primary-color;
background-color: @primary-color;
.@{switch-prefix-cls}-inner {
left: 8px;
}
&:after {
left: 25px;
}
&:active:after {
left: 19px;
}
}
&-disabled {
cursor: @cursor-disabled;
background: #f3f3f3;
border-color: #f3f3f3;
&:after {
background: #ccc;
cursor: not-allowed;
}
.@{switch-prefix-cls}-inner {
color: #ccc;
}
}
}