import { ToggleButton, ToggleButtonGroup } from "@mui/material"; import React, { memo, useCallback } from "react"; import { makeStylesEdt } from "../../theme"; import { important } from "../../utils"; export type CheckboxBooleanProps = { onClick(value: boolean): void; id?: string; label?: string; checked?: boolean; disabled?: boolean; className?: string; }; const CheckboxBoolean = memo((props: CheckboxBooleanProps) => { const { onClick, id, label, checked, disabled, className } = props; const { classes, cx } = useStyles(); const valAsString = checked === null ? "" : checked + ""; const [localValue, setLocalValue] = React.useState(valAsString); const handleOptions = useCallback((_event: React.MouseEvent, value: string) => { setLocalValue(value); const valAsBool = value === "true" ? true : false; onClick(valAsBool); }, []); return ( Non Oui ); }); const useStyles = makeStylesEdt({ "name": { CheckboxBoolean } })(theme => ({ "MuiToggleButton": { border: important("2px solid white"), borderRadius: important("6px"), padding: "0.5rem 3rem", backgroundColor: "white", color: theme.palette.primary.main, "&.Mui-selected": { borderColor: important(theme.palette.primary.main), fontWeight: "bold", backgroundColor: "white", color: theme.palette.primary.main, }, }, "separator": { marginLeft: important("1rem"), }, })); export default CheckboxBoolean;