import { Fragment } from 'react' import { Switch } from '@headlessui/react' import MoonLoader from 'react-spinners/MoonLoader' interface Props { active: boolean, onChange: (value: boolean) => void, isLoading?: boolean, label?: string, } const SwitchComponent = (props: Props) => { const handleChange = (value: boolean) => { props.onChange(value) } if (props.isLoading) { return ( ) } return (
{({ checked }) => ( )} { props.label &&
: {props.label}
}
) } export default SwitchComponent