import React from 'react'; import { Toggle } from 'soapbox/components/ui'; import type { Map as ImmutableMap } from 'immutable'; interface ISettingToggle { /** Unique identifier for the Toggle. */ id?: string, /** The full user settings map. */ settings: ImmutableMap, /** Array of key names leading into the setting map. */ settingPath: string[], /** Callback when the setting is toggled. */ onChange: (settingPath: string[], checked: boolean) => void, } /** Stateful toggle to change user settings. */ const SettingToggle: React.FC = ({ id, settings, settingPath, onChange }) => { const handleChange: React.ChangeEventHandler = ({ target }) => { onChange(settingPath, target.checked); }; return ( ); }; export default SettingToggle;