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
47 lines (40 loc) · 875 Bytes
/
index.tsx
File metadata and controls
47 lines (40 loc) · 875 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
import * as React from 'react'
import {
TableComponent,
Headers,
Header,
Body,
RowComponent,
CellComponent,
} from './elements'
type Header = {
title: string
width: string
}
type TableProps = {
headers: Header[]
}
const Table: React.SFC<TableProps> = ({ headers, children }) => (
<TableComponent>
<Headers>
<Row>
{headers.map((header) => (
<Header key={header.title} width={header.width}>
{header.title}
</Header>
))}
</Row>
</Headers>
<Body>{children}</Body>
</TableComponent>
)
export const Row: React.SFC = ({ children }) => (
<RowComponent>{children}</RowComponent>
)
type CellProps = {
wordwrap?: string
}
export const Cell: React.SFC<CellProps> = ({ wordwrap, children }) => (
<CellComponent wordwrap={wordwrap}>{children}</CellComponent>
)
export default Table