Skip to content

Commit 159b471

Browse files
add icons on the dropdown
1 parent 2beebac commit 159b471

File tree

6 files changed

+53
-14
lines changed

6 files changed

+53
-14
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,56 @@
11
import { SelectableItem } from '@/object-record/select/types/SelectableItem';
2+
import {
3+
IconApi,
4+
IconCsv,
5+
IconGmail,
6+
IconGoogleCalendar,
7+
IconSettingsAutomation,
8+
IconUserCircle,
9+
} from 'twenty-ui';
210

311
export const getSourceEnumOptions = (
412
selectedItemIds: string[],
513
): SelectableItem[] => {
614
return [
715
{
816
id: 'MANUAL',
9-
name: 'MANUAL',
17+
name: 'User',
1018
isSelected: selectedItemIds.includes('MANUAL'),
19+
AvatarIcon: IconUserCircle,
20+
isIconInverted: true,
1121
},
1222
{
1323
id: 'IMPORT',
14-
name: 'IMPORT',
24+
name: 'Import',
1525
isSelected: selectedItemIds.includes('IMPORT'),
26+
AvatarIcon: IconCsv,
27+
isIconInverted: true,
1628
},
1729
{
1830
id: 'API',
19-
name: 'API',
31+
name: 'Api',
2032
isSelected: selectedItemIds.includes('API'),
33+
AvatarIcon: IconApi,
34+
isIconInverted: true,
2135
},
2236
{
2337
id: 'EMAIL',
24-
name: 'EMAIL',
38+
name: 'Email',
2539
isSelected: selectedItemIds.includes('EMAIL'),
40+
AvatarIcon: IconGmail,
2641
},
2742
{
2843
id: 'CALENDAR',
29-
name: 'CALENDAR',
44+
name: 'Calendar',
3045
isSelected: selectedItemIds.includes('CALENDAR'),
46+
AvatarIcon: IconGoogleCalendar,
47+
},
48+
{
49+
id: 'WORKFLOW',
50+
name: 'Workflow',
51+
isSelected: selectedItemIds.includes('WORKFLOW'),
52+
AvatarIcon: IconSettingsAutomation,
53+
isIconInverted: true,
3154
},
3255
];
3356
};

packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/getSubMenuOptions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const getSubMenuOptions = (subMenu: FilterType | null) => {
1111
},
1212
{
1313
name: 'Creator Name',
14-
icon: 'IconUserCircle',
14+
icon: 'IconId',
1515
type: 'ACTOR',
1616
},
1717
];

packages/twenty-front/src/modules/object-record/select/components/MultipleSelectDropdown.tsx

+18-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import styled from '@emotion/styled';
12
import { useEffect, useState } from 'react';
23
import { useRecoilValue } from 'recoil';
34
import { Key } from 'ts-key-enum';
4-
import { Avatar } from 'twenty-ui';
5+
import { AvatarChip } from 'twenty-ui';
56

67
import { SelectableItem } from '@/object-record/select/types/SelectableItem';
78
import { DropdownMenuSkeletonItem } from '@/ui/input/relation-picker/components/skeletons/DropdownMenuSkeletonItem';
@@ -14,6 +15,16 @@ import { MenuItem } from '@/ui/navigation/menu-item/components/MenuItem';
1415
import { MenuItemMultiSelectAvatar } from '@/ui/navigation/menu-item/components/MenuItemMultiSelectAvatar';
1516
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
1617

18+
const StyledAvatarChip = styled(AvatarChip)`
19+
&.avatar-icon-container {
20+
color: ${({ theme }) => theme.font.color.secondary};
21+
gap: ${({ theme }) => theme.spacing(2)};
22+
padding-left: 0px;
23+
padding-right: 0px;
24+
font-size: ${({ theme }) => theme.font.size.md};
25+
}
26+
`;
27+
1728
export const MultipleSelectDropdown = ({
1829
selectableListId,
1930
hotkeyScope,
@@ -120,15 +131,16 @@ export const MultipleSelectDropdown = ({
120131
handleItemSelectChange(item, newCheckedValue);
121132
}}
122133
avatar={
123-
<Avatar
134+
<StyledAvatarChip
135+
className="avatar-icon-container"
136+
name={item.name}
124137
avatarUrl={item.avatarUrl}
138+
LeftIcon={item.AvatarIcon}
139+
avatarType={item.avatarType}
140+
isIconInverted={item.isIconInverted}
125141
placeholderColorSeed={item.id}
126-
placeholder={item.name}
127-
size="md"
128-
type={item.avatarType ?? 'rounded'}
129142
/>
130143
}
131-
text={item.name}
132144
/>
133145
);
134146
})}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
import { AvatarType } from 'twenty-ui';
1+
import { AvatarType, IconComponent } from 'twenty-ui';
22

33
export type SelectableItem<T = object> = T & {
44
id: string;
55
name: string;
66
avatarUrl?: string;
77
avatarType?: AvatarType;
8+
AvatarIcon?: IconComponent;
89
isSelected: boolean;
10+
isIconInverted?: boolean;
911
};

packages/twenty-front/src/modules/ui/navigation/menu-item/components/MenuItemMultiSelectAvatar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type MenuItemMultiSelectAvatarProps = {
2222
avatar?: ReactNode;
2323
selected: boolean;
2424
isKeySelected?: boolean;
25-
text: string;
25+
text?: string;
2626
className?: string;
2727
onSelectChange?: (selected: boolean) => void;
2828
};

packages/twenty-ui/src/display/chip/components/Chip.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ export const Chip = ({
127127
rightComponent,
128128
accent = ChipAccent.TextPrimary,
129129
onClick,
130+
className,
130131
}: ChipProps) => {
131132
return (
132133
<StyledContainer
@@ -137,6 +138,7 @@ export const Chip = ({
137138
size={size}
138139
variant={variant}
139140
onClick={onClick}
141+
className={className}
140142
>
141143
{leftComponent}
142144
<OverflowingTextWithTooltip

0 commit comments

Comments
 (0)