Use SelectableList in RelationPicker, SingleEntitySelectBase and MultipleEntitySelect (#2949)
* 2747-fix: conditional updation of selectedItemId * 2747-fix: bug in toggling * 2747-feat: SingleEntitySelectBase list changed to SelectableList * 2747-feat: MultipleEntitySelect use SelectableList * Fix lint * 2747-fix: onEnter property fix for SingleEntitySelectBase * 2747-fix: onEnter property fix for MultipleEntitySelect * yarn fix in twenty-front --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -19,6 +19,7 @@ const StyledLeftContentWithCheckboxContainer = styled.div`
|
||||
type MenuItemMultiSelectAvatarProps = {
|
||||
avatar?: ReactNode;
|
||||
selected: boolean;
|
||||
isKeySelected: boolean;
|
||||
text: string;
|
||||
className?: string;
|
||||
onSelectChange?: (selected: boolean) => void;
|
||||
@ -29,6 +30,7 @@ export const MenuItemMultiSelectAvatar = ({
|
||||
text,
|
||||
selected,
|
||||
className,
|
||||
isKeySelected,
|
||||
onSelectChange,
|
||||
}: MenuItemMultiSelectAvatarProps) => {
|
||||
const handleOnClick = () => {
|
||||
@ -36,7 +38,11 @@ export const MenuItemMultiSelectAvatar = ({
|
||||
};
|
||||
|
||||
return (
|
||||
<StyledMenuItemBase className={className} onClick={handleOnClick}>
|
||||
<StyledMenuItemBase
|
||||
className={className}
|
||||
onClick={handleOnClick}
|
||||
isKeySelected={isKeySelected}
|
||||
>
|
||||
<StyledLeftContentWithCheckboxContainer>
|
||||
<Checkbox checked={selected} />
|
||||
<StyledMenuItemLeftContent>
|
||||
|
||||
@ -7,6 +7,7 @@ import { MenuItemAccent } from '../../types/MenuItemAccent';
|
||||
|
||||
export type MenuItemBaseProps = {
|
||||
accent?: MenuItemAccent;
|
||||
isKeySelected?: boolean;
|
||||
};
|
||||
|
||||
export const StyledMenuItemBase = styled.li<MenuItemBaseProps>`
|
||||
@ -15,8 +16,13 @@ export const StyledMenuItemBase = styled.li<MenuItemBaseProps>`
|
||||
|
||||
align-items: center;
|
||||
|
||||
background: ${({ isKeySelected, theme }) =>
|
||||
isKeySelected
|
||||
? theme.background.transparent.light
|
||||
: theme.background.primary};
|
||||
border-radius: ${({ theme }) => theme.border.radius.sm};
|
||||
cursor: pointer;
|
||||
|
||||
display: flex;
|
||||
|
||||
flex-direction: row;
|
||||
@ -26,8 +32,8 @@ export const StyledMenuItemBase = styled.li<MenuItemBaseProps>`
|
||||
gap: ${({ theme }) => theme.spacing(2)};
|
||||
|
||||
height: calc(32px - 2 * var(--vertical-padding));
|
||||
|
||||
justify-content: space-between;
|
||||
|
||||
padding: var(--vertical-padding) var(--horizontal-padding);
|
||||
|
||||
${hoverBackground};
|
||||
|
||||
Reference in New Issue
Block a user