diff --git a/src/components/ui/combobox.tsx b/src/components/ui/combobox.tsx index 5344e35..c9f3495 100644 --- a/src/components/ui/combobox.tsx +++ b/src/components/ui/combobox.tsx @@ -10,7 +10,7 @@ import { CommandGroup, CommandInput, CommandItem, - CommandList, + CommandList, CommandSeparator, } from "@/components/ui/command" import { Drawer, @@ -195,7 +195,23 @@ const ComboBoxContent = React.forwardRef< ComboBoxContent.displayName = "ComboBoxContent" function OptionList() { - const { options, setSelectedOption, setOpen, onChange } = useComboBox(); + const { options, prominentOptions, setSelectedOption, setOpen, onChange } = useComboBox(); + + function renderOption(option: Option) { + return ( + { + setSelectedOption(option) + onChange(option.value) + setOpen(false) + }} + > + {option.label} + + ) + } return ( @@ -203,19 +219,17 @@ function OptionList() { No results found. - {options.map((option) => ( - { - setSelectedOption(option) - onChange(option.value) - setOpen(false) - }} - > - {option.label} - - ))} + {options + .filter(option => prominentOptions?.has(option.value) ?? false) + .map(renderOption) + } + + + + {options + .filter(option => !(prominentOptions?.has(option.value) ?? false)) + .map(renderOption) + }