From edc23160a80b754d1d1e5790aa739bdd26a88540 Mon Sep 17 00:00:00 2001 From: Mike Decker Date: Thu, 23 Nov 2023 02:37:34 -0800 Subject: [PATCH] Add no results for search page --- app/search/search-results.tsx | 57 +++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/app/search/search-results.tsx b/app/search/search-results.tsx index 983ca95f..a40ecaf6 100644 --- a/app/search/search-results.tsx +++ b/app/search/search-results.tsx @@ -5,6 +5,7 @@ import Link from "@components/elements/link"; import {useSearchParams} from "next/navigation"; import {Metadata} from "next"; import {ArrowPathIcon} from "@heroicons/react/20/solid"; + interface Result extends Metadata { id: string; type: string; @@ -57,32 +58,36 @@ const SearchResults = ({search}: { search: (search: string) => Promise - {results && - <> -
- Showing {results.length} {!searchString ? 'suggestions.' : `results for ${searchString}.`} -
- {isLoading && -
- -
- } - - +
+ Showing {results.length} {!searchString ? 'suggestions.' : `results for ${searchString}.`} +
+ {isLoading && +
+ +
+ } + {results.length === 0 &&
No results found for your search. Please try another keyword.
} + + {results.length > 0 && + } )