frontAnswerer/lib/ui_kit/CustomCheckbox.tsx

40 lines
944 B
TypeScript
Raw Normal View History

import { Checkbox, FormControlLabel } from "@mui/material";
2023-12-16 14:55:56 +00:00
import React from "react";
import { CheckboxIcon } from "@icons/Checkbox";
import type { SxProps } from "@mui/material";
interface Props {
label: string;
handleChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
checked?: boolean;
sx?: SxProps;
dataCy?: string;
2023-12-29 00:58:19 +00:00
colorIcon?: string;
2023-12-16 14:55:56 +00:00
}
2023-12-29 00:58:19 +00:00
export default function CustomCheckbox({ label, handleChange, checked, sx, dataCy, colorIcon }: Props) {
2023-12-16 14:55:56 +00:00
return (
<FormControlLabel
control={
<Checkbox
sx={{ padding: "0px 13px 1px 11px" }}
disableRipple
icon={<CheckboxIcon />}
2023-12-29 00:58:19 +00:00
checkedIcon={<CheckboxIcon checked color={colorIcon} />}
2023-12-16 14:55:56 +00:00
onChange={handleChange}
checked={checked}
data-cy={dataCy}
/>
}
label={label}
sx={{
2023-12-29 00:58:19 +00:00
color: "#9A9AAF",
2023-12-16 14:55:56 +00:00
height: "26px",
...sx,
}}
/>
);
}