|
1 | | -import React from 'react' |
| 1 | +import React from 'react'; |
2 | 2 |
|
3 | | -import { storiesOf } from '@storybook/react' |
| 3 | +import { storiesOf } from '@storybook/react'; |
4 | 4 |
|
5 | | -import ContentLoader, { Facebook, Instagram, Code, List, BulletList } from '../src/index' |
| 5 | +import ContentLoader, { Facebook, Instagram, Code, List, BulletList } from '../src/index'; |
6 | 6 |
|
7 | 7 | let defaultStyle = { |
8 | | - width: 400, |
9 | | - marginLeft: 'auto', |
10 | | - marginRight: 'auto', |
11 | | -} |
| 8 | + width: 400, |
| 9 | + marginLeft: 'auto', |
| 10 | + marginRight: 'auto', |
| 11 | + fontFamily: 'sans-serif', |
| 12 | + fontSize: 14 |
| 13 | +}; |
12 | 14 |
|
13 | | -const Container = props => <div style={defaultStyle}>{props.children}</div> |
| 15 | +const Container = props => <div style={defaultStyle}>{props.children}</div>; |
14 | 16 |
|
15 | 17 | const MyLoader = () => { |
16 | | - return ( |
17 | | - <ContentLoader height={140} speed={1} primaryColor={'#333'} secondaryColor={'#999'}> |
18 | | - <rect x="80" y="17" rx="4" ry="4" width="300" height="13" /> |
19 | | - <rect x="82" y="44" rx="3" ry="3" width="250" height="10" /> |
20 | | - <circle cx="35" cy="35" r="35" /> |
21 | | - </ContentLoader> |
22 | | - ) |
23 | | -} |
| 18 | + return ( |
| 19 | + <ContentLoader height={140} speed={1} primaryColor={'#333'} secondaryColor={'#999'}> |
| 20 | + <rect x="80" y="17" rx="4" ry="4" width="300" height="13" /> |
| 21 | + <rect x="82" y="44" rx="3" ry="3" width="250" height="10" /> |
| 22 | + <circle cx="35" cy="35" r="35" /> |
| 23 | + </ContentLoader> |
| 24 | + ); |
| 25 | +}; |
24 | 26 |
|
25 | 27 | storiesOf('ContentLoader', module) |
26 | | - .add('facebook style', () => ( |
27 | | - <Container> |
28 | | - <Facebook /> |
29 | | - </Container> |
30 | | - )) |
31 | | - .add('instagram style', () => ( |
32 | | - <Container> |
33 | | - <Instagram /> |
34 | | - </Container> |
35 | | - )) |
36 | | - .add('code style', () => ( |
37 | | - <Container> |
38 | | - <Code /> |
39 | | - </Container> |
40 | | - )) |
41 | | - .add('list style', () => ( |
42 | | - <Container> |
43 | | - <List /> |
44 | | - </Container> |
45 | | - )) |
46 | | - .add('bullet list style', () => ( |
47 | | - <Container> |
48 | | - <BulletList /> |
49 | | - </Container> |
50 | | - )) |
51 | | - .add('custom style', () => ( |
52 | | - <Container> |
53 | | - <MyLoader /> |
54 | | - </Container> |
55 | | - )) |
56 | | - .add('className', () => ( |
57 | | - <Container> |
58 | | - <ContentLoader className="random-className" /> |
59 | | - </Container> |
60 | | - )) |
61 | | - .add('width and height', () => ( |
62 | | - <Container> |
63 | | - <ContentLoader width={400} height={150} /> |
64 | | - </Container> |
65 | | - )) |
66 | | - .add('unique-key: for SSR', () => ( |
67 | | - <Container> |
68 | | - <ContentLoader uniquekey="unique-key" /> |
69 | | - </Container> |
70 | | - )) |
71 | | - .add('no animation', () => ( |
72 | | - <Container> |
73 | | - <Facebook animate={false} /> |
74 | | - </Container> |
75 | | - )) |
| 28 | + .add('facebook style', () => ( |
| 29 | + <Container> |
| 30 | + <Facebook /> |
| 31 | + </Container> |
| 32 | + )) |
| 33 | + .add('instagram style', () => ( |
| 34 | + <Container> |
| 35 | + <Instagram /> |
| 36 | + </Container> |
| 37 | + )) |
| 38 | + .add('code style', () => ( |
| 39 | + <Container> |
| 40 | + <Code /> |
| 41 | + </Container> |
| 42 | + )) |
| 43 | + .add('list style', () => ( |
| 44 | + <Container> |
| 45 | + <List /> |
| 46 | + </Container> |
| 47 | + )) |
| 48 | + .add('bullet list style', () => ( |
| 49 | + <Container> |
| 50 | + <BulletList /> |
| 51 | + </Container> |
| 52 | + )) |
| 53 | + .add('custom style', () => ( |
| 54 | + <Container> |
| 55 | + <MyLoader /> |
| 56 | + </Container> |
| 57 | + )) |
| 58 | + .add('className', () => ( |
| 59 | + <Container> |
| 60 | + <ContentLoader className="random-className" /> |
| 61 | + </Container> |
| 62 | + )) |
| 63 | + .add('width and height', () => ( |
| 64 | + <Container> |
| 65 | + <ContentLoader width={400} height={150} /> |
| 66 | + </Container> |
| 67 | + )) |
| 68 | + .add('unique-key: for SSR', () => ( |
| 69 | + <Container> |
| 70 | + <ContentLoader uniquekey="unique-key" /> |
| 71 | + </Container> |
| 72 | + )) |
| 73 | + .add('no animation', () => ( |
| 74 | + <Container> |
| 75 | + <Facebook animate={false} /> |
| 76 | + </Container> |
| 77 | + )) |
| 78 | + .add('safari bug-fix', () => ( |
| 79 | + <Container> |
| 80 | + <p>Original:</p> |
| 81 | + <ContentLoader primaryColor="rgba(0,0,0,0.06)" secondaryColor="rgba(0,0,0,0.12)" /> |
| 82 | + |
| 83 | + <p>Fix for Safari:</p> |
| 84 | + <ContentLoader |
| 85 | + primaryColor="rgb(0,0,0)" |
| 86 | + secondaryColor="rgb(0,0,0)" |
| 87 | + primaryOpacity={0.06} |
| 88 | + secondaryOpacity={0.12} |
| 89 | + /> |
| 90 | + </Container> |
| 91 | + )); |
0 commit comments