-
Notifications
You must be signed in to change notification settings - Fork 11
/
switcher.scss
128 lines (107 loc) · 2.3 KB
/
switcher.scss
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
$disabledOpacity: 0.4;
$fontSize: 12px;
$fontFamily: 'Lucida Sans Unicode', 'Lucida Grande', sans-serif;
.switcher {
cursor: pointer;
font-family: $fontFamily;
font-size: $fontSize;
text-transform: uppercase;
display: inline-block;
*display: inline;
*zoom: 1;
.content {
position: relative;
user-select: none;
}
.text {
display: none;
overflow: hidden;
text-align: center;
white-space: nowrap;
}
&.is-disabled {
opacity: $disabledOpacity;
}
}
.switcher.default {
$colorActive: #519b20;
$colorSecondary: #fff;
$colorBorder: #dfdfdf;
background-color: $colorSecondary;
border: 1px solid $colorBorder;
border-radius: 4px;
line-height: 26px;
min-width: 80px;
padding: 2px;
transition: background-color 0.3s;
input {
display: none;
}
.slider {
background-color: $colorSecondary;
border-radius: 4px;
box-shadow: 0 0 2px 1px $colorBorder;
height: 26px;
left: 0;
position: absolute;
top: 0;
transform: translateX(0%);
transition: transform 0.3s;
width: 50%;
z-index: 2;
}
.text {
width: 50%;
display: inline-block;
*display: inline;
*zoom: 1;
}
.textYes {
color: $colorSecondary;
float: left;
}
.textNo {
color: darken($colorBorder, 25%);
float: right;
}
&.is-active {
background-color: $colorActive;
.slider {
transform: translateX(100%);
}
}
}
.switcher.short {
$colorActive: #519b20;
$colorBorder: #aaa;
cursor: pointer;
display: inline-block;
margin-right: 5px;
vertical-align: middle;
input {
display: none;
}
.content {
border: 1px solid $colorBorder;
border-radius: 50%;
height: 18px;
padding: 0;
width: 18px;
}
.slider {
background-color: $colorActive;
border-radius: 50%;
height: 12px;
margin: 3px;
opacity: 0;
transform: scale(0);
transition: all 0.2s;
width: 12px;
}
&.is-active {
.slider {
opacity: 1;
transform: scale(1);
}
}
}