summaryrefslogtreecommitdiff
path: root/src/components/DataTable.tsx
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2021-03-14 02:32:09 +0300
committereug-vs <eug-vs@keemail.me>2021-03-14 02:32:26 +0300
commit64a537425a05a15ecfac3bf314735876dbbd8ed7 (patch)
tree526d83464a470ee8311744b4736ae7545c0fcd30 /src/components/DataTable.tsx
parentcfb287490d353166cf0a3db7105d8002cc473f00 (diff)
downloadcommercel-ui-64a537425a05a15ecfac3bf314735876dbbd8ed7.tar.gz
feat: pull Products from api
Diffstat (limited to 'src/components/DataTable.tsx')
-rw-r--r--src/components/DataTable.tsx5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/components/DataTable.tsx b/src/components/DataTable.tsx
index e75af18..e005454 100644
--- a/src/components/DataTable.tsx
+++ b/src/components/DataTable.tsx
@@ -9,12 +9,12 @@ interface Field {
interface Props {
title: string;
- items: any[];
+ items?: any[];
fields: Field[];
handleRowClick?: (index: number) => void;
}
-const DataTable: React.FC<Props> = ({ title, items, fields, handleRowClick = () => {} }) => {
+const DataTable: React.FC<Props> = ({ title, items = [], fields, handleRowClick = () => {} }) => {
return (
<>
<div className="mb-2 flex justify-between items-center">
@@ -22,6 +22,7 @@ const DataTable: React.FC<Props> = ({ title, items, fields, handleRowClick = ()
<Button size="sm">Добавить</Button>
</div>
<ListTable items={items} fields={fields} handleRowClick={handleRowClick} />
+ {items.length === 0 && <div className="text-center p-6">No data</div>}
</>
);
};