import { Switch } from '@mantine/core'; import { useOptionsContext } from './Options.context'; type OptionSwitchProps = { label: string; description?: string; error?: string; path: string; }; export function OptionSwitch({ label, description, error, path }: OptionSwitchProps) { const { getOptions, updateOptions } = useOptionsContext(); const handleEnabledChange = (value: any) => { updateOptions(path, value); }; const checked = (getOptions(path) ?? false) as unknown as boolean; return ( handleEnabledChange(event.currentTarget.checked)} label={label} description={description} error={error} labelPosition="right" /> ); }