Skip to content

Commit

Permalink
Enhancement - collection tagfilters first (#973)
Browse files Browse the repository at this point in the history
* make 'others' a const

* extract into consts

* extract into getYearFilters

* extract getCategoryFilters

* add correct types

* extract getTagFilters

* rename to singular

* move logic into each get*Filter function to improve readability

* fix import

* remove type renaming during import

* refactor imports location

* refactor: standardize code structure

* only return filters with at least 2 items

* add storybook

* reorder collection filters to put "tags" first

* do not render "category" if there's no category filter

* remove shouldShowCategory

* resolve merge

* resolve merge
  • Loading branch information
adriangohjw authored Jan 7, 2025
1 parent ec7e344 commit 69c314b
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import { getYearFilter } from "./getYearFilter"
export const getAvailableFilters = (
items: ProcessedCollectionCardProps[],
): Filter[] => {
// TODO: Allow user to pass in order of filters to be shown
return [
...getTagFilters(items),
getCategoryFilter(items),
getYearFilter(items),
...getTagFilters(items),
].filter((filter) => filter.items.length >= 1)
}

0 comments on commit 69c314b

Please sign in to comment.