diff --git a/packages/frontend/src/components/shared/Select/Select.tsx b/packages/frontend/src/components/shared/Select/Select.tsx index 02e1eab3..d3bfa5a5 100644 --- a/packages/frontend/src/components/shared/Select/Select.tsx +++ b/packages/frontend/src/components/shared/Select/Select.tsx @@ -17,7 +17,7 @@ import { } from 'components/shared/CustomIcon'; import { cloneIcon } from 'utils/cloneIcon'; import { cn } from 'utils/classnames'; -import { SelectItem } from './SelectItem'; +import { SelectItem, EmptySelectItem } from './SelectItem'; import { SelectValue } from './SelectValue'; export type SelectOption = { @@ -300,7 +300,7 @@ export const Select = ({ } return placeholderProp; }, [hideValues, multiple, selectedItems.length, placeholderProp]); - + console.log('filteredItems', filteredItems.length === 0); return (
{/* Label & description */} @@ -372,8 +372,7 @@ export const Select = ({ 'bottom-[65%]': dropdownPosition === 'top' && label && description, })} > - {isOpen && - filteredItems.length !== 0 && + {isOpen && filteredItems.length !== 0 ? ( filteredItems.map((item, index) => ( - ))} + )) + ) : ( + + )}
); diff --git a/packages/frontend/src/components/shared/Select/SelectItem/SelectItem.tsx b/packages/frontend/src/components/shared/Select/SelectItem/SelectItem.tsx index dc671371..3b2b683d 100644 --- a/packages/frontend/src/components/shared/Select/SelectItem/SelectItem.tsx +++ b/packages/frontend/src/components/shared/Select/SelectItem/SelectItem.tsx @@ -26,21 +26,11 @@ export interface SelectItemProps option: SelectOption; orientation?: SelectOrientation; hovered?: boolean; - empty?: boolean; } const SelectItem = forwardRef( ( - { - className, - selected, - option, - orientation, - hovered, - empty, - variant, - ...props - }, + { className, selected, orientation, hovered, variant, option, ...props }, ref, ) => { const theme = selectItemTheme({ active: hovered, orientation, variant }); @@ -60,14 +50,6 @@ const SelectItem = forwardRef( return null; }, [rightIcon]); - if (empty) { - return ( -
  • - No results found -
  • - ); - } - return (
  • ( SelectItem.displayName = 'SelectItem'; +/** + * Represents an empty select item. + * @returns {JSX.Element} - A JSX element representing the empty select item. + */ +export const EmptySelectItem = () => { + const theme = selectItemTheme(); + return ( +
  • +

    + No results found +

    +
  • + ); +}; + export { SelectItem };