From 96869502c3033f857ce68f0f6d9a58e83c8f30a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20H=C3=A5rek=20Andreassen?= Date: Sat, 30 Mar 2024 16:33:21 +0100 Subject: [PATCH] style: Give better feedback for a search MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tim Hårek Andreassen --- components/SeriesCard.tsx | 2 +- routes/index.tsx | 33 +++++++++++++++++++++------------ 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/components/SeriesCard.tsx b/components/SeriesCard.tsx index 0dae82e..50ed1b9 100644 --- a/components/SeriesCard.tsx +++ b/components/SeriesCard.tsx @@ -7,7 +7,7 @@ export default function SeriesCard(props: { serie: SearchResult; origin: string return (
-

{props.serie.title}

+

{props.serie.title}

{props.serie.description}

{feedUrl.toString()} diff --git a/routes/index.tsx b/routes/index.tsx index 024dd56..1d04993 100644 --- a/routes/index.tsx +++ b/routes/index.tsx @@ -46,18 +46,7 @@ export default function Home({ data }: PageProps) {
- {data.result - ? ( -
- {data.result.map((result) => ( - - ))} -
- ) - : null} +
) { ); } + +function SearchResult({ result, origin }: { result: SearchResultList; origin: string }) { + if (!result) { + return null; + } + if (result.length === 0) { + return

Ingen resultater

; + } + return ( +
+

Søkeresultat: {result.length} treff

+ {result.map((result) => ( + + ))} +
+ ); +}