Skip to content

Commit

Permalink
Custom filtering when using the location input search in the sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
SARodrigues committed Oct 7, 2024
1 parent 1b7d4e7 commit 0c4dead
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,13 @@ const LocationDropdown: FCWithMessages<LocationDropdownProps> = ({
}
);

const handleFiltering = (value: string, search: string) => {
if (value.toLocaleLowerCase().includes(search.toLocaleLowerCase())) return 1;
return 0;
};

return (
<Command label={t('search-country-region')} className={cn(className)}>
<Command label={t('search-country-region')} className={cn(className)} filter={handleFiltering}>
<CommandInput placeholder={searchPlaceholder} />
<CommandEmpty>{t('no-result')}</CommandEmpty>
<CommandGroup className="mt-4 max-h-64 overflow-y-auto">
Expand Down

0 comments on commit 0c4dead

Please sign in to comment.