Skip to content

Commit fcce3ea

Browse files
committed
Redefine options
1 parent 0360c92 commit fcce3ea

File tree

3 files changed

+92
-74
lines changed

3 files changed

+92
-74
lines changed
Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
.ui.option {
2+
3+
.control__indicator::after {
4+
transform: translateY(-4px);
5+
top: 0;
6+
}
7+
28
&.checkbox {
39
.control__input {
4-
&:checked ~ .control__indicator {
5-
background: $control-checked-bg url("/static/v2/img/icons/checkmark.svg") no-repeat center;
6-
}
7-
}
8-
9-
&.disabled {
10-
.control__input {
11-
&:checked ~ .control__indicator {
12-
background: $control-disabled-bg url("/static/v2/img/icons/checkmark.svg") no-repeat center;
13-
}
10+
&:checked ~ .control__indicator::after {
11+
background-image: url("/static/v2/img/icons/checkmark.svg");
12+
background-repeat: no-repeat;
13+
background-position: 50% 50%;
14+
transform: translateY(0);
1415
}
1516
}
1617
}
17-
}
18+
}

src/v2/scss/components/_forms/_options.scss

Lines changed: 66 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,82 +4,97 @@
44
// Default styles for checkbox and radio
55

66
.ui.option {
7-
display: flex;
8-
align-items: flex-start;
9-
margin: 0 0 spacer("4x") 0;
10-
cursor: pointer;
7+
display: block;
118
position: relative;
9+
margin-bottom: 1rem;
10+
padding-left: 26px;
11+
cursor: pointer;
1212
line-height: 1.2;
13-
font-size: $font-size-base;
13+
font-size: $font-size-content-base;
1414

15-
&:hover {
16-
.control__indicator {
17-
border-color: $control-bg-hover;
15+
.control__input {
16+
position: absolute;
17+
width: 1px;
18+
height: 1px;
19+
margin: -1px;
20+
padding: 0;
21+
overflow: hidden;
22+
border: 0;
23+
clip: rect(0 0 0 0);
24+
}
25+
26+
.control__indicator {
27+
line-height: 1.2;
28+
29+
&::after {
30+
content: "";
31+
position: absolute;
32+
z-index: 201;
33+
left: 0;
34+
width: $control-size;
35+
height: $control-size;
36+
opacity: 0;
1837
}
1938

20-
.control__description {
21-
color: $input-color;
39+
&::before {
40+
content: "";
41+
display: block;
42+
position: absolute;
43+
z-index: 200;
44+
width: $control-size;
45+
height: $control-size;
46+
top: 0;
47+
left: 0;
48+
border-radius: $border-radius;
49+
border: $control-border-width solid $control-border-color;
50+
background-color: $control-bg;
51+
transition: .075s ease-out;
52+
transition-property: transform, border-color, background-color;
2253
}
2354
}
2455

25-
.control__input {
26-
position: absolute;
27-
top: 50%;
28-
left: 12px;
29-
transform: translate(-50%, -50%);
30-
opacity: 0;
31-
margin: 0;
32-
padding: 0;
33-
34-
&:checked {
35-
~ .control__indicator {
56+
.control__input:checked {
57+
~ .control__indicator {
58+
&::before {
3659
border: none;
37-
background: $control-checked-bg;
60+
background-color: $control-checked-bg;
61+
}
62+
63+
&::after {
64+
opacity: 1;
65+
transition: opacity .075s ease-in-out, transform .125s ease-in-out;
3866
}
3967
}
68+
}
4069

41-
&:focus {
42-
~ .control__indicator {
70+
.control__input:focus {
71+
~ .control__indicator {
72+
&::before {
4373
border: none;
4474
box-shadow: inset 0 0 2px 1px rgba($gray-darker, .5);
4575
}
4676
}
4777
}
4878

49-
.control__indicator {
50-
display: block;
51-
position: absolute;
52-
width: $control-size;
53-
height: $control-size;
54-
border: $control-border-width solid $control-border-color;
55-
border-radius: $border-radius;
56-
background-color: $control-bg;
57-
background-size: 135%;
58-
}
59-
60-
.control__description {
61-
margin: 0 0 0 26px;
62-
display: inline-block;
63-
color: $control-color;
79+
&:hover {
80+
.control__indicator::before {
81+
border: $control-border-width solid $gray-dark;
82+
}
6483
}
6584

6685
&.disabled {
6786
cursor: default;
87+
opacity: .5;
6888

69-
&:hover .control__indicator {
70-
border-color: $control-border-color;
89+
.control__indicator::before {
90+
border-color: $control-disabled-bg;
7191
}
7292

73-
.control__input {
74-
&:checked ~ .control__indicator {
75-
background: $control-disabled-bg;
76-
93+
&:hover {
94+
.control__indicator::before {
95+
border-color: $control-disabled-bg;
7796
}
7897
}
79-
80-
.control__description {
81-
color: $control-disabled-bg;
82-
}
8398
}
8499
}
85100

@@ -89,7 +104,7 @@
89104
display: block;
90105

91106
.option:last-child {
92-
margin-bottom: 0!important;
107+
margin-bottom: 0 !important;
93108
}
94109

95110
&.inline {
@@ -114,4 +129,4 @@
114129
margin-bottom: 0;
115130
}
116131
}
117-
}
132+
}

src/v2/scss/components/_forms/_radio.scss

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,24 @@
22
&.radio {
33
.control__input {
44
&:checked ~ .control__indicator::after {
5-
content: "";
6-
position: absolute;
7-
top: 0;
8-
bottom: 0;
9-
left: 0;
10-
right: 0;
11-
margin: auto;
12-
width: 10px;
13-
height: 10px;
5+
left: 6px;
6+
top: 6px;
7+
width: 8px;
8+
height: 8px;
9+
background-color: #fff;
1410
border-radius: 50%;
15-
background: $white;
11+
transform: scale(1);
1612
}
1713
}
1814

19-
.control__indicator {
15+
.control__indicator::before {
2016
border-radius: 50%;
2117
}
18+
19+
.control__indicator::after {
20+
background-image: none;
21+
transform: scale(.5);
22+
transition: opacity .075s ease-in-out, transform .125s ease-in-out;
23+
}
2224
}
23-
}
25+
}

0 commit comments

Comments
 (0)