-
-
Notifications
You must be signed in to change notification settings - Fork 609
/
table.tsx
49 lines (41 loc) · 844 Bytes
/
table.tsx
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
49
import React from 'react';
import {faker} from '@faker-js/faker';
import {Box, Text, render} from '../../src/index.js';
const users = Array.from({length: 10})
.fill(true)
.map((_, index) => ({
id: index,
name: faker.internet.userName(),
email: faker.internet.email(),
}));
function Table() {
return (
<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 />);