fix(frontend): search icons by prefix, not contains

This commit is contained in:
Sam 2023-04-19 17:22:20 +02:00 committed by Gitea
parent cd8f165a17
commit b4501f5ede

View file

@ -24,7 +24,12 @@
let searchBox = "";
let filteredIcons: string[] = [];
$: filteredIcons = searchBox ? icons.filter((icon) => icon.includes(searchBox)).slice(0, 15) : [];
$: filteredIcons = searchBox
? icons
.filter((icon) => icon.startsWith(searchBox))
.sort()
.slice(0, 15)
: [];
</script>
<InputGroup class="m-1">