overleaf-cep/services/web/frontend/js/features/ide-redesign/components/settings/toggle-setting.tsx
Mathias Jakobsen 733bc26ed1 Merge pull request #23848 from overleaf/dp-settings
Add initial components for new editor settings modal

GitOrigin-RevId: e3eb511d2af9265e0fc1cf54178b3e2953717950
2025-03-05 09:05:34 +00:00

34 lines
674 B
TypeScript

import Setting from './setting'
import OLFormSwitch from '@/features/ui/components/ol/ol-form-switch'
export default function ToggleSetting({
id,
label,
description,
checked,
onChange,
disabled,
}: {
id: string
label: string
description: string
checked: boolean | undefined
onChange: (newValue: boolean) => void
disabled?: boolean
}) {
const handleChange = () => {
onChange(!checked)
}
return (
<Setting controlId={id} label={label} description={description}>
<OLFormSwitch
id={id}
onChange={handleChange}
checked={checked}
label={label}
disabled={disabled}
/>
</Setting>
)
}