toggle-setting.tsx 674 B

12345678910111213141516171819202122232425262728293031323334
  1. import Setting from './setting'
  2. import OLFormSwitch from '@/features/ui/components/ol/ol-form-switch'
  3. export default function ToggleSetting({
  4. id,
  5. label,
  6. description,
  7. checked,
  8. onChange,
  9. disabled,
  10. }: {
  11. id: string
  12. label: string
  13. description: string
  14. checked: boolean | undefined
  15. onChange: (newValue: boolean) => void
  16. disabled?: boolean
  17. }) {
  18. const handleChange = () => {
  19. onChange(!checked)
  20. }
  21. return (
  22. <Setting controlId={id} label={label} description={description}>
  23. <OLFormSwitch
  24. id={id}
  25. onChange={handleChange}
  26. checked={checked}
  27. label={label}
  28. disabled={disabled}
  29. />
  30. </Setting>
  31. )
  32. }