From cfb287490d353166cf0a3db7105d8002cc473f00 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Sun, 14 Mar 2021 01:38:55 +0300
Subject: feat: add DataTable component

---
 src/components/DataTable.tsx | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 src/components/DataTable.tsx

(limited to 'src/components/DataTable.tsx')

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;
-- 
cgit v1.2.3

