fix-dropdown-sort-icons (#2656)
This commit is contained in:
@ -2,6 +2,7 @@ import { useCallback, useState } from 'react';
|
||||
|
||||
import { IconChevronDown } from '@/ui/display/icon';
|
||||
import { LightButton } from '@/ui/input/button/components/LightButton';
|
||||
import { useLazyLoadIcons } from '@/ui/input/hooks/useLazyLoadIcons';
|
||||
import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';
|
||||
import { DropdownMenuHeader } from '@/ui/layout/dropdown/components/DropdownMenuHeader';
|
||||
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
|
||||
@ -60,6 +61,8 @@ export const ObjectSortDropdownButton = ({
|
||||
resetState();
|
||||
};
|
||||
|
||||
const { icons } = useLazyLoadIcons();
|
||||
|
||||
return (
|
||||
<DropdownScope dropdownScopeId={ObjectSortDropdownId}>
|
||||
<Dropdown
|
||||
@ -97,15 +100,17 @@ export const ObjectSortDropdownButton = ({
|
||||
</DropdownMenuHeader>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItemsContainer>
|
||||
{availableSortDefinitions.map((availableSort, index) => (
|
||||
<MenuItem
|
||||
testId={`select-sort-${index}`}
|
||||
key={index}
|
||||
onClick={() => handleAddSort(availableSort)}
|
||||
LeftIcon={availableSort.Icon}
|
||||
text={availableSort.label}
|
||||
/>
|
||||
))}
|
||||
{availableSortDefinitions.map(
|
||||
(availableSortDefinition, index) => (
|
||||
<MenuItem
|
||||
testId={`select-sort-${index}`}
|
||||
key={index}
|
||||
onClick={() => handleAddSort(availableSortDefinition)}
|
||||
LeftIcon={icons[availableSortDefinition.iconName]}
|
||||
text={availableSortDefinition.label}
|
||||
/>
|
||||
),
|
||||
)}
|
||||
</DropdownMenuItemsContainer>
|
||||
</>
|
||||
)}
|
||||
|
||||
@ -1,10 +1,8 @@
|
||||
import { IconComponent } from '@/ui/display/icon/types/IconComponent';
|
||||
|
||||
import { SortDirection } from './SortDirection';
|
||||
|
||||
export type SortDefinition = {
|
||||
fieldMetadataId: string;
|
||||
label: string;
|
||||
Icon?: IconComponent;
|
||||
iconName: string;
|
||||
getOrderByTemplate?: (direction: SortDirection) => any[];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user