summaryrefslogtreecommitdiff
path: root/src/components/DataTable.tsx
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2021-03-14 01:38:55 +0300
committereug-vs <eug-vs@keemail.me>2021-03-14 01:38:55 +0300
commitcfb287490d353166cf0a3db7105d8002cc473f00 (patch)
tree779cdbd01757ac46b565422c32946e52213a4fcc /src/components/DataTable.tsx
parent05ccf76dbbb54e52ae81a469f91b3660057058dc (diff)
downloadcommercel-ui-cfb287490d353166cf0a3db7105d8002cc473f00.tar.gz
feat: add DataTable component
Diffstat (limited to 'src/components/DataTable.tsx')
-rw-r--r--src/components/DataTable.tsx29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/components/DataTable.tsx b/src/components/DataTable.tsx
new file mode 100644
index 0000000..e75af18
--- /dev/null
+++ b/src/components/DataTable.tsx
@@ -0,0 +1,29 @@
+import React from 'react';
+import ListTable from './ListTable';
+import Button from './Button';
+
+interface Field {
+ key: string;
+ label: string;
+}
+
+interface Props {
+ title: string;
+ items: any[];
+ fields: Field[];
+ handleRowClick?: (index: number) => void;
+}
+
+const DataTable: React.FC<Props> = ({ title, items, fields, handleRowClick = () => {} }) => {
+ return (
+ <>
+ <div className="mb-2 flex justify-between items-center">
+ <span className="text-2xl font-bold">{title}</span>
+ <Button size="sm">Добавить</Button>
+ </div>
+ <ListTable items={items} fields={fields} handleRowClick={handleRowClick} />
+ </>
+ );
+};
+
+export default DataTable;