frontPanel/src/ui_kit/CustomCheckbox.tsx

56 lines
1.1 KiB
TypeScript
Raw Normal View History

2023-12-31 02:53:25 +00:00
import {
FormControlLabel,
Checkbox,
useTheme,
Box,
useMediaQuery,
} from "@mui/material";
import React from "react";
2022-12-26 10:00:03 +00:00
import CheckboxIcon from "@icons/Checkbox";
2023-12-13 07:51:59 +00:00
2023-09-07 14:14:48 +00:00
import type { SxProps } from "@mui/material";
2022-12-26 10:00:03 +00:00
interface Props {
2023-09-15 12:37:12 +00:00
label: string;
handleChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
checked?: boolean;
sx?: SxProps;
2023-11-04 17:04:24 +00:00
dataCy?: string;
colorIcon?: string;
2022-12-26 10:00:03 +00:00
}
2023-12-31 02:53:25 +00:00
export default function CustomCheckbox({
label,
handleChange,
checked,
sx,
dataCy,
colorIcon,
}: Props) {
2023-09-15 12:37:12 +00:00
const theme = useTheme();
2023-09-25 13:43:15 +00:00
const isMobile = useMediaQuery(theme.breakpoints.down(790));
2023-09-15 12:37:12 +00:00
return (
<FormControlLabel
2023-09-25 13:43:15 +00:00
control={
<Checkbox
sx={{ padding: "0px 13px 1px 11px" }}
disableRipple
2023-12-13 07:51:59 +00:00
icon={<CheckboxIcon />}
checkedIcon={<CheckboxIcon checked color={colorIcon} />}
2023-09-25 13:43:15 +00:00
onChange={handleChange}
checked={checked}
2023-11-04 17:04:24 +00:00
data-cy={dataCy}
2023-09-25 13:43:15 +00:00
/>
}
2023-09-15 12:37:12 +00:00
label={label}
sx={{
color: "#9A9AAF",
2023-09-25 13:43:15 +00:00
height: "26px",
2023-09-15 12:37:12 +00:00
...sx,
}}
/>
);
2022-12-26 10:00:03 +00:00
}