From 063a19d9ece0a705d00dcb462b81dd7517d6422d Mon Sep 17 00:00:00 2001 From: Daniel O'Connell Date: Tue, 20 Feb 2024 11:10:29 +0100 Subject: [PATCH] Dont show empty tables --- app/components/Table/index.tsx | 41 ++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/app/components/Table/index.tsx b/app/components/Table/index.tsx index 33497be0..31c08709 100644 --- a/app/components/Table/index.tsx +++ b/app/components/Table/index.tsx @@ -18,23 +18,26 @@ export type ListTableProps = { className?: string } -export const ListTable = ({elements, sameTab, className}: ListTableProps) => ( -
- {elements.map(({pageid, title, subtitle, hasIcon}, i) => ( - -
-
{title}
- {subtitle &&
{subtitle}
} -
- {hasIcon && } - - ))} -
-) +export const ListTable = ({elements, sameTab, className}: ListTableProps) => { + if (!elements || elements.length === 0) return null + return ( +
+ {elements.map(({pageid, title, subtitle, hasIcon}, i) => ( + +
+
{title}
+ {subtitle &&
{subtitle}
} +
+ {hasIcon && } + + ))} +
+ ) +} export default ListTable