Skip to content

Commit

Permalink
preview: Reduce the number of results displayed in search results (#997)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamijin-fanta authored Dec 3, 2024
1 parent 9d7ecf4 commit 1393664
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions packages/preview-astro/src/components/search/search-iconset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,18 @@ export function SearchIconSet({

const found =
icons &&
Object.keys(icons).filter((name) =>
query
.toLowerCase()
.split(" ")
.filter((t) => !!t)
.every((term) => name.toLowerCase().includes(term)),
);
Object.keys(icons)
.filter((name) => {
const rules = query
.toLowerCase()
.split(" ")
.filter((t) => !!t);
return rules.length == 0
? false
: rules.every((term) => name.toLowerCase().includes(term));
})
.slice(0, 100); // show top 100 icons

return (
<>
{found ? (
Expand Down

0 comments on commit 1393664

Please sign in to comment.