Skip to content

Commit

Permalink
🔍️ Improve searchability of the icons: case insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
EdoardoGruppi authored Feb 6, 2024
1 parent fb95d14 commit d6da490
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/cards/cards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ export function Cards() {

useEffect(() => {
setFilteredIcons(
Object.keys(icons.current).filter(
(key) =>
key.includes(filter) ||
icons.current[key].desc.includes(filter) ||
icons.current[key].keys.includes(filter)
)
Object.keys(icons.current).filter((key) => {
const lowerFilter = filter.trim().toLowerCase();
return (
key.toLowerCase().includes(lowerFilter) ||
icons.current[key].desc.toLowerCase().includes(lowerFilter) ||
icons.current[key].keys.toLowerCase().includes(lowerFilter)
);
})
);
}, [filter]);

Expand Down

0 comments on commit d6da490

Please sign in to comment.