From dd3e15da787a6f1979164a72458c45fefb1da6c0 Mon Sep 17 00:00:00 2001 From: Nitesh Balusu <84944042+niteshbalusu11@users.noreply.github.com> Date: Tue, 8 Nov 2022 09:58:16 -0500 Subject: [PATCH] make table title dynamic --- src/client/dashboard/PendingChart.tsx | 2 +- .../standard_components/app-components/BasicTable.tsx | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/client/dashboard/PendingChart.tsx b/src/client/dashboard/PendingChart.tsx index 16388b7..b827c84 100644 --- a/src/client/dashboard/PendingChart.tsx +++ b/src/client/dashboard/PendingChart.tsx @@ -31,7 +31,7 @@ const PendingChart = () => { }, []); resgisterCharts(); - return !!data && !!data.length ? : null; + return !!data && !!data.length ? : null; }; export default PendingChart; diff --git a/src/client/standard_components/app-components/BasicTable.tsx b/src/client/standard_components/app-components/BasicTable.tsx index c8b07d8..0472f46 100644 --- a/src/client/standard_components/app-components/BasicTable.tsx +++ b/src/client/standard_components/app-components/BasicTable.tsx @@ -8,14 +8,17 @@ import TableContainer from '@mui/material/TableContainer'; import TableHead from '@mui/material/TableHead'; import TableRow from '@mui/material/TableRow'; +// Creates a basic table with rows and title. + function createData(data: string) { return { data }; } type Args = { rows: string[]; + title: string; }; -const BasicTable = ({ rows }: Args) => { +const BasicTable = ({ rows, title }: Args) => { const data = rows.map(n => createData(n)); return ( @@ -23,7 +26,7 @@ const BasicTable = ({ rows }: Args) => { - Pending Things + {title}