Skip to content

Commit

Permalink
feat: add custom EmptyViews
Browse files Browse the repository at this point in the history
  • Loading branch information
rosvik committed May 11, 2024
1 parent aa82fca commit 3156b6e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Search/SearchPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ export default function SearchPage() {
onSearchTextChange={setQuery}
isLoading={isLoading}
>
{!favorites.length && !venueResults.length && (
<List.EmptyView description="Start typing to search for a stop place. If you add any stops as favorites, they will show up here." />
)}
<List.Section title="Favorites">
{favorites
.filter((v) => v.properties.name.toUpperCase().indexOf(query?.toUpperCase() ?? "") >= 0)
Expand Down
3 changes: 3 additions & 0 deletions src/StopPlace/StopPlacePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ export default function StopPlacePage({ venue }: { venue: Feature }) {
filtering={{ keepSectionOrder: true }}
isShowingDetail={showDetails}
>
{!favoriteDepartures?.length && !departuresWithSortedQuays?.length && (
<List.EmptyView description="Looks like there are no departures from this stop in the near future" />
)}
{favoriteDepartures && favoriteDepartures.length > 0 && (
<List.Section title="Favorites">
{favoriteDepartures
Expand Down

0 comments on commit 3156b6e

Please sign in to comment.