switch.less
2.29 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
@switch-prefix-cls: ~"@{css-prefix}switch";
.@{switch-prefix-cls} {
display: inline-block;
width: 44px;
height: 22px;
line-height: 20px;
border-radius: 22px;
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: 23px;
i {
width: 12px;
height: 12px;
text-align: center;
}
}
&:after {
content: '';
width: 18px;
height: 18px;
border-radius: 18px;
background-color: #fff;
position: absolute;
left: 1px;
top: 1px;
cursor: pointer;
transition: 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: 28px;
height: 16px;
line-height: 14px;
&:after {
width: 12px;
height: 12px;
}
&:active:after {
width: 14px;
}
}
&-small&-checked:after {
left: 13px;
}
&-small:active&-checked:after {
left: 11px;
}
&-large{
width: 56px;
&:active:after {
width: 26px;
}
}
&-large:active:after {
width: 30px;
}
&-large&-checked:after {
left: 35px;
}
&-large:active&-checked:after {
left: 23px;
}
&-checked {
border-color: @primary-color;
background-color: @primary-color;
.@{switch-prefix-cls}-inner {
left: 7px;
}
&:after {
left: 23px;
}
&:active:after {
left: 15px;
}
}
&-disabled {
cursor: @cursor-disabled;
background: #f3f3f3;
border-color: #f3f3f3;
&:after {
background: #ccc;
cursor: not-allowed;
}
.@{switch-prefix-cls}-inner {
color: #ccc;
}
}
}