diff options
author | eug-vs <eug-vs@keemail.me> | 2021-03-14 01:38:55 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2021-03-14 01:38:55 +0300 |
commit | cfb287490d353166cf0a3db7105d8002cc473f00 (patch) | |
tree | 779cdbd01757ac46b565422c32946e52213a4fcc /src/components/DataTable.tsx | |
parent | 05ccf76dbbb54e52ae81a469f91b3660057058dc (diff) | |
download | commercel-ui-cfb287490d353166cf0a3db7105d8002cc473f00.tar.gz |
feat: add DataTable component
Diffstat (limited to 'src/components/DataTable.tsx')
-rw-r--r-- | src/components/DataTable.tsx | 29 |
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; |