fix(subagent): 实验开关改为滑动开关,修复开启态因 bg-primary 未定义而隐形

- Toggle 开启态改用已定义的 bg-blue-600(tailwind 配置无 primary 背景色,
  导致开启态滑轨透明、白色滑块在白底上不可见)
- 子代理开关移至模型下拉之后,统一使用滑动开关
This commit is contained in:
KimiSwitch Dev committed 2026-08-06 01:56:35 +08:00
1 parent 8aed04898c
commit 90cc4a16d2
3 files changed
+86 -21

No files matched your search

+33
View File
@@ -42,6 +42,39 @@ export function Checkbox({
);
}
/** Pill-style toggle switch with a sliding knob. */
export function Toggle({
checked,
disabled,
onChange,
ariaLabel,
}: {
checked: boolean;
disabled?: boolean;
onChange: (checked: boolean) => void;
ariaLabel?: string;
}) {
return (
<button
type="button"
role="switch"
aria-checked={checked}
aria-label={ariaLabel}
disabled={disabled}
onClick={() => onChange(!checked)}
className={`relative h-5 w-9 shrink-0 rounded-full transition-colors duration-200 focus:ring-2 focus:ring-blue-500 focus:outline-none ${
checked ? "bg-blue-600" : "bg-border"
} ${disabled ? "cursor-not-allowed opacity-50" : ""}`}
>
<span
className={`absolute left-0.5 top-0.5 h-4 w-4 rounded-full bg-white shadow-sm transition-transform duration-200 ${
checked ? "translate-x-4" : "translate-x-0"
}`}
/>
</button>
);
}
export function NumberField({
label,
value,