Files
twenty/front/src/modules/ui/menu-item/components/MenuItemMultiSelect.tsx
T
gitstart-twenty 77a1840611 Chore(front): Create a custom eslint rule for Props naming (#1904)
Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Matheus <matheus_benini@hotmail.com>
Co-authored-by: bosiraphael <raphael.bosi@gmail.com>
2023-10-09 16:31:13 +02:00

44 lines
1.2 KiB
TypeScript

import styled from '@emotion/styled';
import { IconComponent } from '@/ui/icon/types/IconComponent';
import { Checkbox } from '@/ui/input/components/Checkbox';
import { MenuItemLeftContent } from '../internals/components/MenuItemLeftContent';
import { StyledMenuItemBase } from '../internals/components/StyledMenuItemBase';
const StyledLeftContentWithCheckboxContainer = styled.div`
align-items: center;
display: flex;
flex-direction: row;
gap: ${({ theme }) => theme.spacing(2)};
`;
type MenuItemMultiSelectProps = {
LeftIcon?: IconComponent;
selected: boolean;
text: string;
className: string;
onSelectChange?: (selected: boolean) => void;
};
export const MenuItemMultiSelect = ({
LeftIcon,
text,
selected,
className,
onSelectChange,
}: MenuItemMultiSelectProps) => {
const handleOnClick = () => {
onSelectChange?.(!selected);
};
return (
<StyledMenuItemBase className={className} onClick={handleOnClick}>
<StyledLeftContentWithCheckboxContainer>
<Checkbox checked={selected} />
<MenuItemLeftContent LeftIcon={LeftIcon} text={text} />
</StyledLeftContentWithCheckboxContainer>
</StyledMenuItemBase>
);
};