Skip to content

Commit e69de53

Browse files
Merge pull request #7396 from christianbeeznest/GH-7378-2
Exercise: Fix legacy checkbox styling (spacing + primary checked state) - refs #7378
2 parents d68da7a + b5d7657 commit e69de53

7 files changed

Lines changed: 173 additions & 103 deletions

File tree

assets/css/scss/_exercise.scss

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,14 @@
3434
font-weight: normal;
3535
}
3636

37+
.question_options .checkbox,
3738
.question_options .radio {
38-
min-height: 18px;
39-
margin-left: 65px;
40-
}
41-
42-
.question_options .checkbox {
43-
margin-left: 65px;
39+
margin-left: 5px;
4440
}
4541

4642
.question_options .radio input[type="radio"], .question_options .checkbox input[type="checkbox"] {
4743
float: left;
48-
margin-left: -25px;
44+
margin-right: 5px;
4945
}
5046

5147
.question_options input[type="text"] {

assets/css/scss/atoms/_checkbox.scss

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,27 @@
9494
.p-checkbox-input:checked + .p-checkbox-box .p-checkbox-icon {
9595
@apply block;
9696
}
97+
.p-checkbox.p-component {
98+
@apply relative inline-flex items-center mr-2;
99+
}
100+
.p-checkbox.p-component input[type="checkbox"] {
101+
@apply absolute top-0 left-0 w-5 h-5 m-0 opacity-0 cursor-pointer;
102+
z-index: 2;
103+
}
104+
.p-checkbox-box {
105+
@apply w-5 h-5 flex items-center justify-center border border-gray-30 rounded;
106+
z-index: 1;
107+
}
108+
.p-checkbox.p-component + label,
109+
.p-checkbox.p-component ~ label {
110+
@apply ml-2;
111+
}
112+
.p-checkbox-box .p-checkbox-icon {
113+
@apply hidden;
114+
}
115+
.p-checkbox.p-component input[type="checkbox"]:checked + .p-checkbox-box {
116+
@apply bg-primary border-primary;
117+
}
118+
.p-checkbox.p-component input[type="checkbox"]:checked + .p-checkbox-box .p-checkbox-icon {
119+
@apply block text-white;
120+
}

0 commit comments

Comments
 (0)