import { cIf, cJoin } from "helpers/className"; import { Immutable } from "helpers/types"; import { useToggle } from "hooks/useToggle"; import { Dispatch, SetStateAction } from "react"; interface Props { setState: Dispatch>; state: boolean; className?: string; disabled?: boolean; } export function Switch(props: Immutable): JSX.Element { const { state, setState, className, disabled } = props; const toggleState = useToggle(setState); return (
{ if (disabled === false) toggleState(); }} >
); }