Skip to content

Commit cfb8617

Browse files
silverwindalgernon
authored andcommitted
Tweak and fix toggle checkboxes (#30527)
Fixes: go-gitea/gitea#30524. Slightly restyled them so that the "knob" is contained inside the background. <img width="179" alt="Screenshot 2024-04-16 at 21 58 09" src="https://github.com/go-gitea/gitea/assets/115237/be94517b-9cb7-46e2-ae96-fcf6767ce4ba"> <img width="187" alt="Screenshot 2024-04-16 at 21 58 50" src="https://github.com/go-gitea/gitea/assets/115237/c13a1959-5c5a-4e88-9225-e5f6fb72e3e0"> (cherry picked from commit 5ccd042f7080e1f4ef4b96591e1b1002a4826115)
1 parent 23f032e commit cfb8617

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

web_src/css/modules/checkbox.css

+10-9
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ input[type="radio"] {
6666
}
6767
.ui.toggle.checkbox input {
6868
width: 3.5rem;
69-
height: 1.5rem;
69+
height: 21px;
7070
opacity: 0;
7171
z-index: 3;
7272
}
@@ -81,29 +81,30 @@ input[type="radio"] {
8181
content: "";
8282
z-index: 1;
8383
top: 0;
84-
width: 3.5rem;
85-
height: 1.5rem;
84+
width: 49px;
85+
height: 21px;
8686
border-radius: 500rem;
8787
left: 0;
8888
}
8989
.ui.toggle.checkbox label::after {
9090
background: var(--color-white);
91+
box-shadow: 1px 1px 4px 1px var(--color-shadow);
9192
position: absolute;
9293
content: "";
9394
opacity: 1;
9495
z-index: 2;
95-
width: 1.5rem;
96-
height: 1.5rem;
97-
top: 0;
98-
left: 0;
96+
width: 18px;
97+
height: 18px;
98+
top: 1.5px;
99+
left: 1.5px;
99100
border-radius: 500rem;
100101
transition: background 0.3s ease, left 0.3s ease;
101102
}
102103
.ui.toggle.checkbox input ~ label::after {
103-
left: -0.05rem;
104+
left: 1.5px;
104105
}
105106
.ui.toggle.checkbox input:checked ~ label::after {
106-
left: 2.15rem;
107+
left: 29px;
107108
}
108109
.ui.toggle.checkbox input:focus ~ label::before,
109110
.ui.toggle.checkbox label::before {

0 commit comments

Comments
 (0)