Skip to content

Commit 09c794f

Browse files
Wibiaslidge-jun
authored andcommitted
fix(gui): center switch knob with flex padding track
(cherry picked from commit 58651a7)
1 parent 610b577 commit 09c794f

1 file changed

Lines changed: 16 additions & 12 deletions

File tree

‎gui/src/styles.css‎

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -408,33 +408,37 @@ select.input { appearance: none; }
408408
/* ---- switch ---- */
409409
.switch {
410410
width: 34px;
411-
height: 19px;
411+
height: 20px;
412412
border-radius: 99px;
413413
border: 1px solid var(--border);
414414
cursor: pointer;
415415
background: var(--raised);
416-
position: relative;
416+
display: inline-flex;
417+
align-items: center;
418+
padding: 2px;
417419
flex-shrink: 0;
420+
line-height: 0;
421+
vertical-align: middle;
418422
transition: background 0.15s, border-color 0.15s;
419-
padding: 0;
420423
appearance: none;
421424
-webkit-appearance: none;
422425
}
423426
.switch.on { background: var(--accent); border-color: var(--accent); }
424427
.switch:disabled { opacity: 0.6; cursor: default; }
425428
.switch .knob {
426-
position: absolute;
427-
top: 50%;
428-
left: 2px;
429-
width: 15px;
430-
height: 15px;
429+
width: 14px;
430+
height: 14px;
431431
border-radius: 50%;
432432
background: light-dark(#ffffff, #ececec);
433-
box-shadow: 0 1px 2px rgba(16, 24, 40, 0.3);
434-
transform: translateY(-50%);
435-
transition: left 0.15s, background 0.15s, transform 0.15s;
433+
box-shadow: 0 0 0 1px rgba(16, 24, 40, 0.08), 0 1px 1px rgba(16, 24, 40, 0.18);
434+
transform: translateX(0);
435+
transition: transform 0.15s, background 0.15s;
436+
}
437+
.switch.on .knob {
438+
transform: translateX(14px);
439+
background: var(--accent-ink);
440+
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
436441
}
437-
.switch.on .knob { left: 17px; background: var(--accent-ink); transform: translateY(-50%); }
438442

439443
/* ---- misc ---- */
440444
.muted { color: var(--muted); }

0 commit comments

Comments
 (0)