Skip to content

Commit

Permalink
sort category filter alphabetically. Fixes #74
Browse files Browse the repository at this point in the history
  • Loading branch information
JeromeBu committed Jan 17, 2024
1 parent e5a5d58 commit 397e12d
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions src/ui/pages/softwareCatalog/SoftwareCatalogSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,16 +216,24 @@ export function SoftwareCatalogSearch(props: Props) {
"label": tCommon("allFeminine"),
"value": ""
},
...categoryOptions.map(({ category, softwareCount }) => ({
"value": category,
"label": `${
lang === "fr"
? softwareCategoriesFrBySoftwareCategoryEn[
category
] ?? category
: category
} (${softwareCount})`
}))
...categoryOptions
.map(({ category, softwareCount }) => ({
"value": category,
"label": `${
lang === "fr"
? softwareCategoriesFrBySoftwareCategoryEn[
category
] ?? category
: category
} (${softwareCount})`
}))
.sort((a, b) => {
const labelA = a.label.toLowerCase();
const labelB = b.label.toLowerCase();
if (labelA < labelB) return -1;
if (labelA > labelB) return 1;
return 0;
})
]}
/>

Expand Down

0 comments on commit 397e12d

Please sign in to comment.