Files
overleaf-cep/services/web/frontend/js/features/ide-redesign/components/settings/toggle-setting.tsx
T
David 213b645875 Merge pull request #28298 from overleaf/dp-editor-switch-split-test
Update editor switching behaviour for new user split test

GitOrigin-RevId: 61ef678ba216323d283bda4cc77d8c465b8c87df
2025-09-09 08:05:22 +00:00

36 lines
704 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: 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>
)
}