import { ChangeEvent, FC } from 'react'; import classNames from 'classnames'; import { v4 as uuid } from 'uuid'; import { identity } from 'ramda'; export interface BooleanControlProps { checked?: boolean; onChange?: (checked: boolean, e: ChangeEvent) => void; className?: string; } interface BooleanControlWithTypeProps extends BooleanControlProps { type: 'switch' | 'checkbox'; } const BooleanControl: FC = ( { checked = false, onChange = identity, className, children, type }, ) => { const id = uuid(); const onChecked = (e: ChangeEvent) => onChange(e.target.checked, e); const typeClasses = { 'custom-switch': type === 'switch', 'custom-checkbox': type === 'checkbox', }; return ( ); }; export default BooleanControl;