From a3ae198ddf92632661888f15cbbedf37c11c9272 Mon Sep 17 00:00:00 2001 From: Bjorn Lammers Date: Fri, 25 Apr 2025 17:55:17 +0200 Subject: [PATCH] refactor(web): Update descriptions and consistency (#1264) * refactor(web): Update descriptions and consistency * revert: Issue templates * refactor(web): More extensive search placeholder --------- Signed-off-by: Bjorn Lammers Co-authored-by: Thomas Camlong --- web/src/components/icon-search.tsx | 142 ++++++++++++++++++++--------- 1 file changed, 101 insertions(+), 41 deletions(-) diff --git a/web/src/components/icon-search.tsx b/web/src/components/icon-search.tsx index 3fdc666c..7d690326 100644 --- a/web/src/components/icon-search.tsx +++ b/web/src/components/icon-search.tsx @@ -225,11 +225,11 @@ export function IconSearch({ icons }: IconSearchProps) { const getSortLabel = (sort: SortOption) => { switch (sort) { case "relevance": - return "Best match" + return "Relevance" case "alphabetical-asc": - return "A to Z" + return "Name (A-Z)" case "alphabetical-desc": - return "Z to A" + return "Name (Z-A)" case "newest": return "Newest first" default: @@ -262,7 +262,7 @@ export function IconSearch({ icons }: IconSearchProps) { handleSearch(e.target.value)} @@ -274,18 +274,18 @@ export function IconSearch({ icons }: IconSearchProps) { {/* Filter dropdown */} - - Categories + Select Categories
@@ -311,7 +311,7 @@ export function IconSearch({ icons }: IconSearchProps) { }} className="cursor-pointer focus: focus:bg-rose-50 dark:focus:bg-rose-950/20" > - Clear all filters + Clear categories )} @@ -327,18 +327,18 @@ export function IconSearch({ icons }: IconSearchProps) { - Sort By + Sort Icons handleSortChange(value as SortOption)}> - Best match + Relevance - A to Z + Name (A-Z) - Z to A + Name (Z-A) @@ -350,9 +350,15 @@ export function IconSearch({ icons }: IconSearchProps) { {/* Clear all button */} {(searchQuery || selectedCategories.length > 0 || sortOption !== "relevance") && ( - )}
@@ -360,7 +366,7 @@ export function IconSearch({ icons }: IconSearchProps) { {/* Active filter badges */} {selectedCategories.length > 0 && (
- Filters: + Selected:
{selectedCategories.map((category) => ( @@ -386,7 +392,7 @@ export function IconSearch({ icons }: IconSearchProps) { }} className="text-xs h-7 px-2 cursor-pointer" > - Clear all + Clear
)} @@ -397,27 +403,33 @@ export function IconSearch({ icons }: IconSearchProps) { {filteredIcons.length === 0 ? (
-

We don't have this one...yet!

+

Icon not found

+

Help us expand our collection

+
+
+ +
+ Can't submit it yourself? + +
- -
) : ( <> @@ -438,3 +450,51 @@ export function IconSearch({ icons }: IconSearchProps) { ) } + +function IconCard({ + name, + data: iconData, + matchedAlias, +}: { + name: string + data: Icon + matchedAlias?: string | null +}) { + return ( + + +
+ {`${name} +
+ + {name.replace(/-/g, " ")} + + + {matchedAlias && Alias: {matchedAlias}} + +
+ ) +} + +interface IconsGridProps { + filteredIcons: { name: string; data: Icon }[] + matchedAliases: Record +} + +function IconsGrid({ filteredIcons, matchedAliases }: IconsGridProps) { + return ( + <> +
+ {filteredIcons.slice(0, 120).map(({ name, data }) => ( + + ))} +
+ {filteredIcons.length > 120 &&

And {filteredIcons.length - 120} more...

} + + ) +}