feat(settings): move request logging toggle behind hidden entry

This commit is contained in:
Supra4E8C
2025-12-22 22:41:50 +08:00
parent 68974ffc68
commit 94962158ef
7 changed files with 151 additions and 29 deletions

View File

@@ -5,15 +5,26 @@ interface ToggleSwitchProps {
onChange: (value: boolean) => void;
label?: ReactNode;
disabled?: boolean;
labelPosition?: 'left' | 'right';
}
export function ToggleSwitch({ checked, onChange, label, disabled = false }: ToggleSwitchProps) {
export function ToggleSwitch({
checked,
onChange,
label,
disabled = false,
labelPosition = 'right'
}: ToggleSwitchProps) {
const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
onChange(event.target.checked);
};
const className = ['switch', labelPosition === 'left' ? 'switch-label-left' : '']
.filter(Boolean)
.join(' ');
return (
<label className="switch">
<label className={className}>
<input type="checkbox" checked={checked} onChange={handleChange} disabled={disabled} />
<span className="track">
<span className="thumb" />