Files
ox_lib/web/src/features/menu/list/CustomCheckbox.tsx
T

36 lines
901 B
TypeScript
Raw Normal View History

2022-10-29 12:23:15 +02:00
import { Box, Flex, useCheckbox, chakra, CheckboxIcon } from '@chakra-ui/react';
const CustomCheckbox: React.FC<{ checked: boolean }> = ({ checked }) => {
const { getCheckboxProps, getInputProps, htmlProps } = useCheckbox();
return (
<chakra.label
2022-10-29 12:46:22 +02:00
display="flex"
flexDirection="row"
alignItems="center"
2022-10-29 12:23:15 +02:00
gridColumnGap={2}
2022-10-29 12:46:22 +02:00
pr={3}
cursor="pointer"
2022-10-29 12:23:15 +02:00
{...htmlProps}
>
<input {...getInputProps()} hidden />
<Flex
2022-10-29 12:46:22 +02:00
alignItems="center"
justifyContent="center"
border="2px solid"
borderColor="#909296"
2022-10-29 12:23:15 +02:00
rounded={'sm'}
2022-10-29 12:46:22 +02:00
w={5}
h={5}
2022-10-29 12:23:15 +02:00
{...getCheckboxProps()}
>
{checked && (
2022-10-29 12:46:22 +02:00
<Box w={4} h={4} bg="#909296">
<CheckboxIcon isChecked color="#25262B" />
2022-10-29 12:23:15 +02:00
</Box>
)}
</Flex>
</chakra.label>
2022-10-29 12:46:22 +02:00
);
2022-10-29 12:23:15 +02:00
};
export default CustomCheckbox;