Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Commit

Permalink
make table title dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
niteshbalusu11 committed Nov 8, 2022
1 parent 26fc584 commit dd3e15d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/client/dashboard/PendingChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const PendingChart = () => {
}, []);

resgisterCharts();
return !!data && !!data.length ? <BasicTable rows={data} /> : null;
return !!data && !!data.length ? <BasicTable rows={data} title={'Pending Things'} /> : null;
};

export default PendingChart;
7 changes: 5 additions & 2 deletions src/client/standard_components/app-components/BasicTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,25 @@ 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 (
<TableContainer component={Paper}>
<Table sx={{ minWidth: 650 }} aria-label="simple table">
<TableHead>
<TableRow>
<TableCell align="left">Pending Things</TableCell>
<TableCell align="left">{title}</TableCell>
</TableRow>
</TableHead>
<TableBody>
Expand Down

0 comments on commit dd3e15d

Please sign in to comment.