Skip to content

Commit

Permalink
Sort tiles alphabetically by name
Browse files Browse the repository at this point in the history
The order in the YAML file is mostly arbitrary. Name is also the default
sort for the resource listing on the same page.
  • Loading branch information
victorlin committed Oct 1, 2024
1 parent 11717a7 commit 29bf64b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions static-site/content/resource-listing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ coreGroupDisplayNames:
# Tiles must define a filter query which is a list of dataset name "words"
# (where words are joined by "/" to form the URL path) as well as a PNG image
# which is relative to static-site/static/pathogen_images.
# These will be displayed in alphabetical order by name.
coreTiles:
- name: SARS-CoV-2
img: ncov_freq.png
Expand Down
7 changes: 6 additions & 1 deletion static-site/src/components/ListResources/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@ function ListResources({
</Byline>

<SetSelectedFilterOptions.Provider value={setSelectedFilterOptions}>
<ExpandableTiles tiles={tiles} tileWidth={tileWidthHeight} tileHeight={tileWidthHeight} TileComponent={Tile} />
<ExpandableTiles
tiles={tiles.sort((a, b) => a.name.localeCompare(b.name))}
tileWidth={tileWidthHeight}
tileHeight={tileWidthHeight}
TileComponent={Tile}
/>
</SetSelectedFilterOptions.Provider>
</>
)}
Expand Down

0 comments on commit 29bf64b

Please sign in to comment.