@@ -4,148 +4,153 @@ import { color, fonts, resetCSS } from '@web3uikit/styles';
4
4
import { CheckboxProps } from './types' ;
5
5
6
6
const inputStyles = css `
7
- ${ resetCSS } ;
8
- position: absolute;
9
- to p: -30px;
7
+ ${ resetCSS } ;
8
+ height: 10px;
9
+ left: -12px;
10
+ position: absolute;
11
+ to p: 0;
12
+ width: 10px;
10
13
` ;
11
14
12
15
const labelStyles = css `
13
- ${ resetCSS } ;
14
- ${ fonts . text } ;
15
- color : ${ color . blueDark } ;
16
- cursor : pointer;
17
- dis play: block;
18
- font- size: 18px;
19
- margin- botto m: 4px;
20
- overflow: hidden;
21
- position: relative;
22
- width: fit- content;
16
+ ${ resetCSS } ;
17
+ ${ fonts . text } ;
18
+ color : ${ color . blueDark } ;
19
+ cursor : pointer;
20
+ dis play: block;
21
+ font- size: 18px;
22
+ margin- botto m: 4px;
23
+ overflow: hidden;
24
+ position: relative;
25
+ width: fit- content;
23
26
` ;
24
27
25
28
const labelDisabled = css `
26
- opacity: 50%;
27
- pointer- events: none;
29
+ opacity: 50%;
30
+ pointer- events: none;
28
31
` ;
29
32
30
33
const boxStyles = css `
31
- padding- left: 28px;
34
+ padding- left: 28px;
35
+
36
+ & : before ,
37
+ .after {
38
+ border-radius : 5px ;
39
+ content : '' ;
40
+ display : block;
41
+ height : 20px ;
42
+ left : 0 ;
43
+ pointer-events : none;
44
+ position : absolute;
45
+ top : 1px ;
46
+ transition : all 0.1s ease-out;
47
+ width : 20px ;
48
+ }
32
49
33
- & : before ,
34
- .after {
35
- border-radius : 5px ;
36
- content : '' ;
37
- display : block;
38
- height : 20px ;
39
- left : 0 ;
40
- pointer-events : none;
41
- position : absolute;
42
- top : 0 ;
43
- transition : all 0.1s ease-out;
44
- width : 20px ;
45
- }
46
-
47
- & : before {
48
- background-color : ${ color . blueLight } ;
49
- border : 1px solid ${ color . blueSky } ;
50
- z-index : 0 ;
51
- }
52
-
53
- .after {
54
- align-items : center;
55
- display : flex;
56
- justify-content : center;
57
- left : 1px ;
58
- opacity : 0 ;
59
- top : 1px ;
60
- z-index : 1 ;
61
- }
62
-
63
- & : hover {
64
50
& : before {
65
- filter : brightness (95% );
51
+ background-color : ${ color . blueLight } ;
52
+ border : 1px solid ${ color . blueSky } ;
53
+ z-index : 0 ;
66
54
}
67
- }
68
55
69
- & : active {
70
- & : before {
71
- filter : brightness (90% );
56
+ .after {
57
+ align-items : center;
58
+ display : flex;
59
+ justify-content : center;
60
+ left : 1px ;
61
+ opacity : 0 ;
62
+ top : 2px ;
63
+ z-index : 1 ;
64
+ }
65
+
66
+ & : hover {
67
+ & : before {
68
+ filter : brightness (95% );
69
+ }
70
+ }
71
+
72
+ & : active {
73
+ & : before {
74
+ filter : brightness (90% );
75
+ }
72
76
}
73
- }
74
77
` ;
75
78
76
79
const boxCheckedStyles = css `
77
- & : before {
78
- background-color : ${ color . green } ;
79
- border-color : ${ color . greenLight } ;
80
- }
81
- .after {
82
- opacity : 1 ;
83
- }
80
+ & : before {
81
+ background-color : ${ color . green } ;
82
+ border-color : ${ color . greenLight } ;
83
+ }
84
+ .after {
85
+ opacity : 1 ;
86
+ }
84
87
` ;
85
88
86
89
const switchStyles = css `
87
- padding-left : 48px ;
90
+ padding-left : 48px ;
88
91
89
- & : before {
90
- background-color : ${ color . greyLight } ;
91
- border-radius : 7px ;
92
- content : '' ;
93
- display : block;
94
- height : 14px ;
95
- left : 3px ;
96
- opacity : 0.4 ;
97
- position : absolute;
98
- top : calc (50% - 7px );
99
- transition : all 0.1s ease-out;
100
- width : 34px ;
101
- }
102
-
103
- & : after {
104
- background-color : ${ color . blueLight } ;
105
- border-radius : 50% ;
106
- border : 1px solid ${ color . blue } ;
107
- content : '' ;
108
- display : block;
109
- height : 20px ;
110
- left : 0 ;
111
- position : absolute;
112
- top : calc (50% - 11px );
113
- transition : all 0.1s ease-out;
114
- width : 20px ;
115
- }
92
+ & : before {
93
+ background-color : ${ color . greyLight } ;
94
+ border-radius : 7px ;
95
+ content : '' ;
96
+ display : block;
97
+ height : 14px ;
98
+ left : 3px ;
99
+ opacity : 0.4 ;
100
+ position : absolute;
101
+ top : calc (50% - 7px );
102
+ transition : all 0.1s ease-out;
103
+ width : 34px ;
104
+ }
116
105
117
- & : hover {
118
106
& : after {
119
- filter : brightness (95% );
107
+ background-color : ${ color . blueLight } ;
108
+ border-radius : 50% ;
109
+ border : 1px solid ${ color . blue } ;
110
+ content : '' ;
111
+ display : block;
112
+ height : 20px ;
113
+ left : 0 ;
114
+ position : absolute;
115
+ top : calc (50% - 11px );
116
+ transition : all 0.1s ease-out;
117
+ width : 20px ;
120
118
}
121
- }
122
119
123
- & : active {
124
- & : after {
125
- filter : brightness (90% );
120
+ & : hover {
121
+ & : after {
122
+ filter : brightness (95% );
123
+ }
124
+ }
125
+
126
+ & : active {
127
+ & : after {
128
+ filter : brightness (90% );
129
+ }
126
130
}
127
- }
128
131
` ;
129
132
130
133
const switchOnStyles = css `
131
- & : before {
132
- background-color : ${ color . green } ;
133
- }
134
-
135
- & : after {
136
- background-color : ${ color . green } ;
137
- border : 1px solid ${ color . green } ;
138
- left : 18px ;
139
- }
134
+ & : before {
135
+ background-color : ${ color . green } ;
136
+ }
137
+
138
+ & : after {
139
+ background-color : ${ color . green } ;
140
+ border : 1px solid ${ color . green } ;
141
+ left : 18px ;
142
+ }
140
143
` ;
141
144
142
145
const StyledInput = styled . input < Pick < CheckboxProps , 'layout' > > `
143
- ${ inputStyles }
146
+ ${ inputStyles }
144
147
` ;
145
148
146
- const StyledLabel = styled . label < Pick < CheckboxProps , 'layout' | 'checked' | 'disabled' > > `
147
- ${ labelStyles }
148
- ${ ( p ) => p . disabled && labelDisabled }
149
+ const StyledLabel = styled . label <
150
+ Pick < CheckboxProps , 'layout' | 'checked' | 'disabled' >
151
+ > `
152
+ ${ labelStyles }
153
+ ${ ( p ) => p . disabled && labelDisabled }
149
154
${ ( p ) => p . layout === 'box' && boxStyles }
150
155
${ ( p ) => p . layout === 'box' && p . checked && boxCheckedStyles }
151
156
${ ( p ) => p . layout === 'switch' && switchStyles }
0 commit comments