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
1 changed files with 6 additions and 1 deletions

View File

@ -24,7 +24,12 @@
let searchBox = ""; let searchBox = "";
let filteredIcons: string[] = []; 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> </script>
<InputGroup class="m-1"> <InputGroup class="m-1">