import { useRecoilState } from 'recoil'; import HoverCardSettings from './HoverCardSettings'; import useLocalize from '~/hooks/useLocalize'; import { Switch } from '~/components/ui'; import { RecoilState } from 'recoil'; interface ToggleSwitchProps { stateAtom: RecoilState; localizationKey: string; hoverCardText?: string; switchId: string; onCheckedChange?: (value: boolean) => void; } const ToggleSwitch: React.FC = ({ stateAtom, localizationKey, hoverCardText, switchId, onCheckedChange, }) => { const [switchState, setSwitchState] = useRecoilState(stateAtom); const localize = useLocalize(); const handleCheckedChange = (value: boolean) => { setSwitchState(value); if (onCheckedChange) { onCheckedChange(value); } }; return (
{localize(localizationKey as any)}
{hoverCardText && }
); }; export default ToggleSwitch;