forked from cerebral/overmind
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.tsx
More file actions
48 lines (41 loc) · 1016 Bytes
/
index.tsx
File metadata and controls
48 lines (41 loc) · 1016 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { createElement, SFC } from 'react'
import * as styles from './styles'
type Header = {
title: string
width: string
}
type TableProps = {
headers?: Header[]
}
const Table: SFC<TableProps> = ({ headers, children }) => (
<table className={styles.tableComponent}>
{headers ? (
<thead>
<Row>
{headers.map((header, index) => (
<th
className={styles.header}
key={header.title + index}
style={{ width: header.width }}
>
{header.title}
</th>
))}
</Row>
</thead>
) : null}
<tbody>{children}</tbody>
</table>
)
export const Row: SFC = ({ children }) => <tr>{children}</tr>
type CellProps = {
wordwrap?: string
mono?: boolean
colSpan?: number
}
export const Cell: SFC<CellProps> = ({ wordwrap, mono, colSpan, children }) => (
<td className={styles.cellComponent(mono, wordwrap)} colSpan={colSpan}>
{children}
</td>
)
export default Table