From d7f5fae14ae36038e704a09014f649bd50aca0ad Mon Sep 17 00:00:00 2001 From: Brandon Egger Date: Thu, 24 Aug 2023 10:13:05 -0500 Subject: [PATCH] add error notice component to resource page --- src/components/notice.tsx | 44 +++++++++++++++++++++++------------ src/pages/resources/index.tsx | 13 +++++++---- 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/src/components/notice.tsx b/src/components/notice.tsx index e0db851..5bd5d70 100644 --- a/src/components/notice.tsx +++ b/src/components/notice.tsx @@ -1,17 +1,31 @@ -import { ExclamationTriangleIcon } from "@heroicons/react/24/outline" +import { ExclamationTriangleIcon } from "@heroicons/react/24/outline"; -export const ErrorNotice = ({header, body, icon}: {header?: string, body?: string, icon?: boolean}) => { - return <> - {header ? ( -
- {icon ? ( -
- -
- ) : undefined} - {header} - {body ? (

{body}

) : undefined} -
- ) : undefined} +export const ErrorNotice = ({ + header, + body, + icon, +}: { + header?: string; + body?: string; + icon?: boolean; +}) => { + return ( + <> + {header ? ( +
+ {icon ? ( +
+ +
+ ) : undefined} + {header} + {body ? ( +

+ {body} +

+ ) : undefined} +
+ ) : undefined} -} \ No newline at end of file + ); +}; diff --git a/src/pages/resources/index.tsx b/src/pages/resources/index.tsx index dbcb3f9..b9bd55b 100644 --- a/src/pages/resources/index.tsx +++ b/src/pages/resources/index.tsx @@ -35,12 +35,17 @@ const Resources = () => { if (resourceQuery.isLoading) { return ; } - + if (!resourceQuery.data || resourceQuery.isError) { - return
- + return ( +
+
+ ); } const totalPages = Math.ceil(resourceQuery.data.count / queryData.perPage);