From 48c8d808b01728584825c252beb8a5ecdc358d02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Salgado?= Date: Fri, 12 Feb 2021 17:45:55 +0000 Subject: [PATCH] feat: add component when a table is empty --- .../src/components/tables/DataTable.js | 8 ++- .../src/components/tables/DataTable.styles.js | 9 +++- .../src/pages/Blacklist/BlacklistTable.js | 7 ++- .../src/pages/Maintenance/MachineStatus.js | 1 + .../src/styling/icons/table/empty-table.svg | 49 +++++++++++++++++++ 5 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 new-lamassu-admin/src/styling/icons/table/empty-table.svg diff --git a/new-lamassu-admin/src/components/tables/DataTable.js b/new-lamassu-admin/src/components/tables/DataTable.js index d62f63a9..500217e8 100644 --- a/new-lamassu-admin/src/components/tables/DataTable.js +++ b/new-lamassu-admin/src/components/tables/DataTable.js @@ -20,6 +20,7 @@ import { import { H4 } from 'src/components/typography' import { ReactComponent as ExpandClosedIcon } from 'src/styling/icons/action/expand/closed.svg' import { ReactComponent as ExpandOpenIcon } from 'src/styling/icons/action/expand/open.svg' +import { ReactComponent as EmptyTableIcon } from 'src/styling/icons/table/empty-table.svg' import styles from './DataTable.styles' @@ -167,7 +168,12 @@ const DataTable = ({ {loading &&

Loading...

} - {!loading && R.isEmpty(data) &&

{emptyText}

} + {!loading && R.isEmpty(data) && ( +
+ +

{emptyText}

+
+ )} {({ height }) => ( { : data[R.keys(data)[0]] return ( - + ) } diff --git a/new-lamassu-admin/src/pages/Maintenance/MachineStatus.js b/new-lamassu-admin/src/pages/Maintenance/MachineStatus.js index 3e459e02..e51a7d8e 100644 --- a/new-lamassu-admin/src/pages/Maintenance/MachineStatus.js +++ b/new-lamassu-admin/src/pages/Maintenance/MachineStatus.js @@ -107,6 +107,7 @@ const MachineStatus = () => { data={machines} Details={InnerMachineDetailsRow} initialExpanded={expandedIndex} + emptyText="No machines so far" expandable /> diff --git a/new-lamassu-admin/src/styling/icons/table/empty-table.svg b/new-lamassu-admin/src/styling/icons/table/empty-table.svg new file mode 100644 index 00000000..76464a0c --- /dev/null +++ b/new-lamassu-admin/src/styling/icons/table/empty-table.svg @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file