|
2 | 2 | <img width="230px" src="https://user-images.githubusercontent.com/4838076/31404417-65822d5e-add2-11e7-90c3-ce8cded1a02e.gif" alt="React Content Loader" title="React Content Loader" /> |
3 | 3 | </p> |
4 | 4 |
|
5 | | -React component that uses SVG to create a collection of loaders which simulates the structure of the content that will be loaded, similar to Facebook cards loaders. **Use the [create-react-content-loader](https://github.com/danilowoz/create-react-content-loader) for your custom loader** |
| 5 | +React component that uses SVG to create a collection of loaders which simulates the structure of the |
| 6 | +content that will be loaded, similar to Facebook cards loaders. **Use the |
| 7 | +[online tool](https://github.com/danilowoz/create-react-content-loader) to create your own custom |
| 8 | +loader** |
6 | 9 |
|
7 | | -If you are looking for [React Native](https://github.com/virusvn/react-native-svg-animated-linear-gradient), [Preact](https://github.com/bonitasoft/preact-content-loader) or [Vue.js](https://github.com/LucasLeandro1204/vue-content-loading) |
| 10 | +If you are looking for |
| 11 | +[React Native](https://github.com/virusvn/react-native-svg-animated-linear-gradient), |
| 12 | +[Preact](https://github.com/bonitasoft/preact-content-loader) or |
| 13 | +[Vue.js](https://github.com/LucasLeandro1204/vue-content-loading) |
8 | 14 |
|
9 | 15 | ## Installation |
10 | 16 |
|
11 | 17 | **Using npm:** |
| 18 | + |
12 | 19 | ```sh |
13 | 20 | npm i react-content-loader --save-dev |
14 | 21 | ``` |
| 22 | + |
15 | 23 | **Using Yarn:** |
| 24 | + |
16 | 25 | ```sh |
17 | 26 | yarn add react-content-loader --save |
18 | 27 | ``` |
19 | 28 |
|
20 | | -## You can use it in two ways: |
| 29 | +## You can use it in two ways: |
21 | 30 |
|
22 | 31 | **Stylized:** [example](#facebook-style) |
| 32 | + |
23 | 33 | ```jsx |
24 | 34 | // import the component |
25 | 35 | import ContentLoader from 'react-content-loader' |
26 | 36 |
|
27 | 37 | const MyLoader = () => { |
28 | | - return( |
29 | | - <ContentLoader type="facebook" /> |
30 | | - ) |
| 38 | + return <ContentLoader type="facebook" /> |
31 | 39 | } |
32 | 40 | ``` |
33 | 41 |
|
34 | 42 | **Or in custom mode:** [example](#custom-style) |
| 43 | + |
35 | 44 | ```jsx |
36 | 45 | // import the component |
37 | 46 | import ContentLoader, { Rect, Circle } from 'react-content-loader' |
38 | 47 |
|
39 | 48 | const MyLoader = () => { |
40 | | - return( |
| 49 | + return ( |
41 | 50 | <ContentLoader height={140} speed={1} primaryColor={'#333'} secondaryColor={'#999'}> |
42 | 51 | <Circle x={195} y={30} radius={30} /> |
43 | 52 | <Rect x={50} y={80} height={10} radius={5} width={300} /> |
44 | 53 | <Rect x={75} y={100} height={10} radius={5} width={250} /> |
45 | 54 | </ContentLoader> |
46 | | - ) |
| 55 | + ) |
47 | 56 | } |
48 | 57 | ``` |
49 | 58 |
|
50 | | - |
51 | 59 | ## Options |
52 | 60 |
|
53 | | -**ContentLoader (wrap) options:** |
54 | | - |
55 | | -| Name | Type | Default | Description | |
56 | | -|---|---|---|---| |
57 | | -| style | _Object_ | `null` | Ex: `{ marginTop: '50px' }` | |
58 | | -| type | _String_ | `facebook` | Options: `facebook`, `instagram`, `list`, `bullet-list`, `code` | |
59 | | -| speed | _Number_ | `2` | Animation speed | |
60 | | -| width | _Number_ | `400` | Width component | |
61 | | -| height | _Number_ | `130` | Height component | |
62 | | -| primaryColor | _String_ | `#f3f3f3` | Background the SVG | |
63 | | -| secondaryColor | _String_ | `#ecebeb` | Animation color | |
64 | | -| preserveAspectRatio | _String_ | `xMidYMid meet` | Aspect ratio option of SVG| |
65 | | - |
| 61 | +| Name | Type | Default | Description | |
| 62 | +| ------------------- | -------- | :-------------: | --------------------------------------------------------------- | |
| 63 | +| style | _Object_ | `null` | Ex: `{ marginTop: '50px' }` | |
| 64 | +| type | _String_ | `facebook` | Options: `facebook`, `instagram`, `list`, `bullet-list`, `code` | |
| 65 | +| speed | _Number_ | `2` | Animation speed | |
| 66 | +| width | _Number_ | `400` | Width component | |
| 67 | +| height | _Number_ | `130` | Height component | |
| 68 | +| primaryColor | _String_ | `#f3f3f3` | Background the SVG | |
| 69 | +| secondaryColor | _String_ | `#ecebeb` | Animation color | |
| 70 | +| preserveAspectRatio | _String_ | `xMidYMid meet` | Aspect ratio option of SVG | |
66 | 71 |
|
67 | 72 | **Custom element options:** |
68 | 73 |
|
69 | | -| | x | y | radius | width | height | |
70 | | -|---|---|---|---|---|---| |
71 | | -| **Rect** | _Number_ | _Number_ | _Number_ | _Number_ | _Number_ | |
72 | | -| **Circle** | _Number_ | _Number_ | _Number_ | – | – | |
| 74 | +| | x | y | radius | width | height | |
| 75 | +| ---------- | -------- | -------- | -------- | :------: | :------: | |
| 76 | +| **Rect** | _Number_ | _Number_ | _Number_ | _Number_ | _Number_ | |
| 77 | +| **Circle** | _Number_ | _Number_ | _Number_ | – | – | |
73 | 78 |
|
74 | | -**Use the [create-react-content-loader](https://github.com/danilowoz/create-react-content-loader) for your custom loader** |
| 79 | +**Use the [create-react-content-loader](https://github.com/danilowoz/create-react-content-loader) |
| 80 | +for your custom loader** |
75 | 81 |
|
76 | 82 | ## Examples |
77 | 83 |
|
78 | 84 | #### Facebook Style |
| 85 | + |
79 | 86 |  |
80 | 87 |
|
81 | 88 | #### Instagram Style |
| 89 | + |
82 | 90 |  |
83 | 91 |
|
84 | 92 | #### Code Style |
| 93 | + |
85 | 94 |  |
86 | 95 |
|
87 | 96 | #### List Style |
| 97 | + |
88 | 98 |  |
89 | 99 |
|
90 | 100 | #### Bullet list Style |
| 101 | + |
91 | 102 |  |
92 | 103 |
|
93 | 104 | #### Custom Style |
| 105 | + |
94 | 106 |  |
95 | 107 |
|
96 | 108 | #### Credits |
|
0 commit comments