Files
overleaf-cep/services/web/frontend/js/features/settings/components/toggle-setting.tsx
Davinder Singh d03ae68294 Merge pull request #31606 from overleaf/ds-editor-settings-tear-down
Tearing down of old Editor (Settings)

GitOrigin-RevId: d9e23e61a8e34eb22e9c9e3453a157fb275f68f0
2026-03-06 09:06:43 +00:00

36 lines
713 B
TypeScript

import React from 'react'
import Setting from './setting'
import OLFormSwitch from '@/shared/components/ol/ol-form-switch'
export default function ToggleSetting({
id,
label,
description,
checked,
onChange,
disabled,
}: {
id: string
label: React.ReactNode
description: React.ReactNode
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>
)
}