polish: make section enable switch more visible

Wrap the switch in a labeled pill ('Enabled'/'Disabled') with border
and background so the off state is clearly visible.
This commit is contained in:
dayuan.jiang
2026-06-10 20:58:58 +09:00
parent 9d958ae9c9
commit c09b454105

View File

@@ -724,17 +724,33 @@ export default function AdminPage() {
{group.title}
</h2>
{group.toggleable && (
<Switch
checked={!!enabledGroups[group.id]}
disabled={!writable}
aria-label={`Enable ${group.title}`}
onCheckedChange={(checked) =>
setEnabledGroups((prev) => ({
...prev,
[group.id]: checked,
}))
}
/>
<label
className={cn(
"flex cursor-pointer items-center gap-2 rounded-full border px-3 py-1.5 text-xs font-medium transition-colors motion-reduce:transition-none",
enabledGroups[group.id]
? "border-primary/30 bg-primary/5 text-primary"
: "border-border bg-muted/50 text-muted-foreground hover:border-foreground/30 hover:text-foreground",
)}
>
{enabledGroups[group.id]
? "Enabled"
: "Disabled"}
<Switch
checked={
!!enabledGroups[group.id]
}
disabled={!writable}
aria-label={`Enable ${group.title}`}
onCheckedChange={(checked) =>
setEnabledGroups(
(prev) => ({
...prev,
[group.id]: checked,
}),
)
}
/>
</label>
)}
</div>
<p className="mb-3 mt-1 text-sm text-muted-foreground text-pretty">