feat: v2 Table Component

This commit is contained in:
Rodrigo Antinarelli authored and James A. Petts committed 2020-05-15 13:38:56 +02:00
1 parent 01c5456ccf
commit 34961e5624
17 files changed
+304 -98

No files matched your search

@@ -0,0 +1,35 @@
import React from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
const Table = ({ children, className, fullWidth, style }) => {
return (
<div
className={classnames(
'text-lg text-white',
{
'w-full': fullWidth,
},
className
)}
style={style}
>
{children}
</div>
);
};
Table.defaultProps = {
className: '',
fullWidth: true,
style: {},
};
Table.propTypes = {
fullWidth: PropTypes.bool,
children: PropTypes.node.isRequired,
className: PropTypes.string,
style: PropTypes.object,
};
export default Table;
@@ -0,0 +1,63 @@
---
name: Table
menu: Components
route: components/table
---
import { Playground, Props, Link } from 'docz';
import { Table, TableHead, TableBody, TableRow, TableCell } from '@ohif/ui';
# Table
Tables display sets of data.
## Import
```javascript
import { Table } from '@ohfi/ui';
```
## Basic usage
<Playground>
<div className="p-4">
<Table>
<TableHead>
<TableRow>
<TableCell>Item 01</TableCell>
<TableCell>Item 02</TableCell>
<TableCell>Item 03</TableCell>
<TableCell>Item 04</TableCell>
</TableRow>
</TableHead>
<TableBody>
<TableRow>
<TableCell>Content 01</TableCell>
<TableCell>Content 02</TableCell>
<TableCell>Content 03</TableCell>
<TableCell>Content 04</TableCell>
</TableRow>
</TableBody>
</Table>
</div>
</Playground>
## Table width
Table has full width by default. If you want to change its width, you will have
to set the `fullWidth` prop to `false` and then define your own table width by
passing a `className` or by `style`.
## Table components
<Link to="components/table-head">TableHead</Link>
<br />
<Link to="components/table-body">TableBody</Link>
<br />
<Link to="components/table-row">TableRow</Link>
<br />
<Link to="components/table-cell">TableCell</Link>
## Properties
<Props of={Table} />
@@ -0,0 +1,2 @@
import Table from './Table';
export default Table;