fix(webui): unify settings switch styles

This commit is contained in:
Xubin Ren committed 2026-09-19 17:59:17 +08:00
1 parent af43292f6f
commit 70bf433018
7 files changed
+105 -53

No files matched your search

@@ -31,6 +31,7 @@ import { Input } from "@/components/ui/input";
import { SegmentedControl } from "@/components/ui/segmented-control";
import { Sheet, SheetContent, SheetDescription, SheetTitle } from "@/components/ui/sheet";
import { SkillsMarketplace } from "@/components/settings/SkillsMarketplace";
import { ToggleButton } from "@/components/settings/ToggleButton";
import { deleteSkill, fetchSkillDetail, updateSkillEnabled } from "@/lib/api";
import { notifySkillsChanged } from "@/lib/skill-events";
import type { SkillDetail, SkillSummary } from "@/lib/types";
@@ -447,15 +448,13 @@ function SkillDetailSheet({
</div>
) : (
<div className="mt-6 space-y-5">
<div className="flex min-h-16 items-start justify-between gap-3 border-y border-border/45 px-1 py-3.5">
<div className="flex min-h-16 items-center justify-between gap-3 border-y border-border/45 px-1 py-3.5">
<p className="text-[13px] font-medium text-foreground">
{t("settings.skills.enabledControl", { defaultValue: "Use this skill" })}
</p>
<button
type="button"
role="switch"
aria-checked={enabled}
aria-label={
<ToggleButton
checked={enabled}
label={
enabled
? t("settings.skills.disableSkill", {
name: activeSkill.name,
@@ -467,26 +466,8 @@ function SkillDetailSheet({
})
}
disabled={actionBusy}
onClick={() => void toggleEnabled()}
className={cn(
"relative -mr-1 h-10 w-14 shrink-0 rounded-full",
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
"disabled:cursor-wait disabled:opacity-60",
)}
>
<span
className={cn(
"absolute left-1.5 top-2 h-6 w-11 rounded-full transition-colors",
enabled ? "bg-foreground" : "bg-muted-foreground/30",
)}
/>
<span
className={cn(
"absolute left-2 top-2.5 h-5 w-5 rounded-full bg-background shadow-sm transition-transform",
enabled ? "translate-x-5" : "translate-x-0",
)}
/>
</button>
onChange={() => void toggleEnabled()}
/>
</div>
{actionError ? (