forked from vadimdemedes/ink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
table.js
48 lines (39 loc) · 804 Bytes
/
table.js
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
'use strict';
const React = require('react');
const Chance = require('chance');
const {render, Box, Text} = require('../..');
const chance = new Chance();
const users = new Array(10).fill(true).map((_, index) => ({
id: index,
name: chance.name(),
email: chance.email()
}));
const Table = () => (
<Box flexDirection="column" width={80}>
<Box>
<Box width="10%">
<Text>ID</Text>
</Box>
<Box width="50%">
<Text>Name</Text>
</Box>
<Box width="40%">
<Text>Email</Text>
</Box>
</Box>
{users.map(user => (
<Box key={user.id}>
<Box width="10%">
<Text>{user.id}</Text>
</Box>
<Box width="50%">
<Text>{user.name}</Text>
</Box>
<Box width="40%">
<Text>{user.email}</Text>
</Box>
</Box>
))}
</Box>
);
render(<Table />);