2022-12-26 10:00:03 +00:00
|
|
|
import { FormControlLabel, Checkbox, useTheme, Box } from "@mui/material";
|
2023-05-07 14:01:03 +00:00
|
|
|
import React from "react";
|
2022-12-26 10:00:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
label: string;
|
2023-05-07 14:01:03 +00:00
|
|
|
handleChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
|
|
checked?: boolean;
|
2022-12-26 10:00:03 +00:00
|
|
|
}
|
|
|
|
|
2023-05-07 14:01:03 +00:00
|
|
|
export default function CustomCheckbox({ label, handleChange, checked}: Props) {
|
2022-12-26 10:00:03 +00:00
|
|
|
const theme = useTheme();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<FormControlLabel
|
2023-05-03 19:21:00 +00:00
|
|
|
control={
|
|
|
|
<Checkbox
|
2022-12-26 10:00:03 +00:00
|
|
|
icon={<Icon />}
|
|
|
|
checkedIcon={<CheckedIcon />}
|
2023-05-03 19:21:00 +00:00
|
|
|
onChange={handleChange}
|
2023-05-07 14:01:03 +00:00
|
|
|
checked={checked}
|
2022-12-26 10:00:03 +00:00
|
|
|
/>}
|
|
|
|
label={label}
|
|
|
|
sx={{
|
|
|
|
color: theme.palette.grey2.main,
|
|
|
|
ml: "-9px",
|
|
|
|
userSelect: "none",
|
|
|
|
}}
|
2023-05-03 19:21:00 +00:00
|
|
|
|
2022-12-26 10:00:03 +00:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
function Icon() {
|
|
|
|
const theme = useTheme();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Box sx={{
|
|
|
|
height: "26px",
|
|
|
|
width: "26px",
|
|
|
|
borderRadius: "8px",
|
|
|
|
backgroundColor: theme.palette.background.default,
|
|
|
|
border: `1px solid ${theme.palette.grey2.main}`,
|
|
|
|
}} />
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
function CheckedIcon() {
|
|
|
|
const theme = useTheme();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Box sx={{
|
|
|
|
height: "26px",
|
|
|
|
width: "26px",
|
|
|
|
borderRadius: "8px",
|
|
|
|
display: "flex",
|
|
|
|
justifyContent: "center",
|
|
|
|
alignItems: "center",
|
2023-04-17 02:27:22 +00:00
|
|
|
backgroundColor: theme.palette.brightPurple.main,
|
2022-12-26 10:00:03 +00:00
|
|
|
border: `1px solid ${theme.palette.grey2.main}`,
|
|
|
|
}}>
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 18" fill="none">
|
2023-04-17 02:27:22 +00:00
|
|
|
<path d="M2 9L10 16.5L22.5 1.5" stroke='#ffffff' strokeWidth="4" strokeLinecap="round" />
|
2022-12-26 10:00:03 +00:00
|
|
|
</svg>
|
|
|
|
</Box>
|
|
|
|
);
|
|
|
|
}
|