1 | import * as React from 'react';
|
2 | import { storiesOf } from '@storybook/react';
|
3 | import styled from 'styled-components';
|
4 | import * as R from 'ramda';
|
5 |
|
6 | import { List, GlobalStyle } from '../src';
|
7 |
|
8 | const Wrapper = styled.div`
|
9 | height: 600px;
|
10 | margin: 20px;
|
11 | `;
|
12 |
|
13 | const users = [
|
14 | {
|
15 | name : 'Mattia Parisi',
|
16 | email : 'mattiaparisi@gmail.com',
|
17 | id : 0
|
18 | },
|
19 | {
|
20 | name : 'Alessia Ciccarello',
|
21 | email : 'alessiaciccarello@gmail.com',
|
22 | id : 1
|
23 | },
|
24 | {
|
25 | name : 'Ciccio Belo',
|
26 | email : 'cicciobelo@gmail.com',
|
27 | id : 2
|
28 | },
|
29 | {
|
30 | name : 'Santo Terranova',
|
31 | email : 'santoterranova@gmail.com',
|
32 | id : 3
|
33 | },
|
34 | {
|
35 | name : 'Damiano Pulvirenti',
|
36 | email : 'damianopulvirenti@gmail.com',
|
37 | id : 4
|
38 | },
|
39 | {
|
40 | name : 'Enrico Bruno',
|
41 | email : 'enricobruno@gmail.com',
|
42 | id : 5
|
43 | },
|
44 | ];
|
45 |
|
46 | const repeatedUsers = (num: number) => R.flatten(R.repeat(users, num));
|
47 |
|
48 | storiesOf('List', module)
|
49 | .add('Default', () => (
|
50 | <React.Fragment>
|
51 | <GlobalStyle />
|
52 | <Wrapper>
|
53 | <List headers={['ID', 'NOME', 'E-MAIL', 'telefone', 'endereco']}>
|
54 | {repeatedUsers(4).map(user => (
|
55 | <React.Fragment>
|
56 | <div>{user.id}</div>
|
57 | <div>{user.name}</div>
|
58 | <div>{user.email}</div>
|
59 | <div>telefone</div>
|
60 | <div>Rua Tal</div>
|
61 | </React.Fragment>
|
62 | ))}
|
63 | </List>
|
64 | </Wrapper>
|
65 | </React.Fragment>
|
66 | )); |
\ | No newline at end of file |