fix(mobile): switches keep their knob inside the track at every text size

The track was w-10, which is rem and followed the text size setting, while
the knob and its travel are px; with a smaller text size the knob hung over
the end of the track. The track is 40 px now.
This commit is contained in:
Maurice
2026-11-06 21:57:10 +01:00
parent fe7847fc08
commit 25091dbd60
+3 -1
View File
@@ -20,7 +20,9 @@ export default function MToggle({ checked, onChange, ariaLabel, disabled = false
selectionHaptic()
onChange(!checked)
}}
className={`box-border h-[22px] w-10 flex-none rounded-full p-[2px] transition-colors duration-[180ms] disabled:opacity-50 ${
// Width in px like the knob and its travel: w-10 is rem and followed the text size,
// so a smaller text setting left the knob hanging over the end of the track.
className={`box-border h-[22px] w-[40px] flex-none rounded-full p-[2px] transition-colors duration-[180ms] disabled:opacity-50 ${
checked ? 'bg-m-act' : 'bg-[color:var(--m-trackoff)]'
} ${className}`}
>