import { Optional } from '~/types'; import classes from './Switch.module.css'; import { useLoader } from '~/contexts/LoaderContext'; import { useEffect } from 'react'; type SwitchProps = { switchName: string; switchDescription: string; checked: Optional; disabled: boolean; loading?: boolean; onChange: (checked: boolean) => void; }; export default function Switch(props: SwitchProps) { const { start, stop } = useLoader(); useEffect(() => { if (props.loading) { start(); } else { stop(); } }, [props.loading, start, stop]); return (

{props.switchDescription}

); }