|
| 1 | +import React from 'react' |
| 2 | + |
| 3 | +import { Facebook, Instagram } from '../src' |
| 4 | + |
| 5 | +export default { |
| 6 | + title: 'React Content Loader', |
| 7 | +} |
| 8 | + |
| 9 | +/** |
| 10 | + * Animated |
| 11 | + */ |
| 12 | +export const animate = () => { |
| 13 | + return <Facebook animate={false} /> |
| 14 | +} |
| 15 | + |
| 16 | +animate.story = { |
| 17 | + parameters: { |
| 18 | + notes: `##\`animate?: boolean\` |
| 19 | + |
| 20 | + Defaults to \`true\`. Opt-out of animations with \`false\``, |
| 21 | + }, |
| 22 | +} |
| 23 | + |
| 24 | +/** |
| 25 | + * Aria label |
| 26 | + */ |
| 27 | +export const ariaLabel = () => { |
| 28 | + return <Facebook ariaLabel="my custom loader" /> |
| 29 | +} |
| 30 | + |
| 31 | +ariaLabel.story = { |
| 32 | + parameters: { |
| 33 | + notes: `## \`ariaLabel? string | boolean\` |
| 34 | +
|
| 35 | + Defaults to \`Loading interface...\`. It's used to describe what element it is. Use \`false\` to remove. |
| 36 | + `, |
| 37 | + }, |
| 38 | +} |
| 39 | + |
| 40 | +/** |
| 41 | + * Base URL |
| 42 | + */ |
| 43 | +export const baseURL = () => { |
| 44 | + return <Facebook baseUrl="path/" /> |
| 45 | +} |
| 46 | + |
| 47 | +baseURL.story = { |
| 48 | + parameters: { |
| 49 | + notes: `## \`baseUrl? string\` |
| 50 | +
|
| 51 | + Required if you're using \`<base url="/" />\` in the \`<head/>\`. Defaults to an empty string. This prop is common used as: \`<ContentLoader baseUrl={window.location.pathname} />\` which will fill the SVG attribute with the relative path. Related [#93](https://github.com/danilowoz/react-content-loader/issues/93). |
| 52 | + `, |
| 53 | + }, |
| 54 | +} |
| 55 | + |
| 56 | +/** |
| 57 | + * Speed |
| 58 | + */ |
| 59 | +export const speed = () => { |
| 60 | + return ( |
| 61 | + <> |
| 62 | + <Facebook speed={4} /> |
| 63 | + <Facebook speed={1} /> |
| 64 | + </> |
| 65 | + ) |
| 66 | +} |
| 67 | + |
| 68 | +speed.story = { |
| 69 | + parameters: { |
| 70 | + notes: `## \`speed?: number\` |
| 71 | +
|
| 72 | + Defaults to \`2\`. Animation speed in seconds.`, |
| 73 | + }, |
| 74 | +} |
| 75 | + |
| 76 | +/** |
| 77 | + * Interval |
| 78 | + */ |
| 79 | +export const interval = () => { |
| 80 | + return <Facebook interval={0.8} /> |
| 81 | +} |
| 82 | + |
| 83 | +interval.story = { |
| 84 | + parameters: { |
| 85 | + notes: `## \`interval?: number\` |
| 86 | +
|
| 87 | + Defaults to \`0.25\`. Interval of time between runs of the animation, as a fraction of the animation speed.`, |
| 88 | + }, |
| 89 | +} |
| 90 | + |
| 91 | +/** |
| 92 | + * Width |
| 93 | + */ |
| 94 | +export const width = () => { |
| 95 | + return <Facebook width={200} /> |
| 96 | +} |
| 97 | + |
| 98 | +width.story = { |
| 99 | + parameters: { |
| 100 | + notes: `## \`width? number\` |
| 101 | +
|
| 102 | + Defaults to \`400\`. It will be set in the viewbox attr in the \`<svg />\`.`, |
| 103 | + }, |
| 104 | +} |
| 105 | + |
| 106 | +/** |
| 107 | + * Height |
| 108 | + */ |
| 109 | +export const height = () => { |
| 110 | + return <Facebook height={50} /> |
| 111 | +} |
| 112 | + |
| 113 | +height.story = { |
| 114 | + parameters: { |
| 115 | + notes: `## \`height? number\` |
| 116 | +
|
| 117 | + Defaults to \`130\`. It will be set in the viewbox attr in the \`<svg />\`.`, |
| 118 | + }, |
| 119 | +} |
| 120 | + |
| 121 | +/** |
| 122 | + * Gradient Ratio |
| 123 | + */ |
| 124 | +export const gradientRatio = () => { |
| 125 | + return ( |
| 126 | + <> |
| 127 | + <Instagram |
| 128 | + gradientRatio={0.2} |
| 129 | + primaryColor={'#333'} |
| 130 | + secondaryColor={'#999'} |
| 131 | + /> |
| 132 | + <Instagram |
| 133 | + gradientRatio={4} |
| 134 | + primaryColor={'#333'} |
| 135 | + secondaryColor={'#999'} |
| 136 | + /> |
| 137 | + </> |
| 138 | + ) |
| 139 | +} |
| 140 | + |
| 141 | +gradientRatio.story = { |
| 142 | + parameters: { |
| 143 | + notes: `## \`gradientRatio? number\` |
| 144 | +
|
| 145 | + Defaults to \`2\`. Width of the animated gradient as a fraction of the viewbox width.`, |
| 146 | + }, |
| 147 | +} |
| 148 | + |
| 149 | +/** |
| 150 | + * RTL |
| 151 | + */ |
| 152 | +export const RTL = () => { |
| 153 | + return <Instagram rtl /> |
| 154 | +} |
| 155 | + |
| 156 | +RTL.story = { |
| 157 | + parameters: { |
| 158 | + notes: `## \`rtl? boolean\` |
| 159 | +
|
| 160 | + Defaults to \`false\`. Content right-to-left.`, |
| 161 | + }, |
| 162 | +} |
| 163 | + |
| 164 | +/** |
| 165 | + * Primary color |
| 166 | + */ |
| 167 | +export const primaryColor = () => { |
| 168 | + return <Facebook primaryColor="#333" /> |
| 169 | +} |
| 170 | + |
| 171 | +primaryColor.story = { |
| 172 | + parameters: { |
| 173 | + notes: `## \`primaryColor?: string\` |
| 174 | +
|
| 175 | + Defaults to \`#f3f3f3\` which is used as background of animation.`, |
| 176 | + }, |
| 177 | +} |
| 178 | + |
| 179 | +/** |
| 180 | + * Secondary color |
| 181 | + */ |
| 182 | +export const secondaryColor = () => { |
| 183 | + return <Facebook secondaryColor="#333" /> |
| 184 | +} |
| 185 | + |
| 186 | +secondaryColor.story = { |
| 187 | + parameters: { |
| 188 | + notes: `## \`secondaryColor?: string\` |
| 189 | +
|
| 190 | + Defaults to \`#ecebeb\` which is used as foreground of animation.`, |
| 191 | + }, |
| 192 | +} |
| 193 | + |
| 194 | +/** |
| 195 | + * Primary opacity |
| 196 | + */ |
| 197 | +export const primaryOpacity = () => { |
| 198 | + return <Facebook primaryOpacity={0.06} /> |
| 199 | +} |
| 200 | + |
| 201 | +primaryOpacity.story = { |
| 202 | + parameters: { |
| 203 | + notes: `## \`primaryOpacity?: number\` |
| 204 | +
|
| 205 | + Defaults to \`1\`. Background opacity (0 = transparent, 1 = opaque) used to solve a issue in [Safari](#bugfix-in-safari)`, |
| 206 | + }, |
| 207 | +} |
| 208 | + |
| 209 | +/** |
| 210 | + * Secondary opacity |
| 211 | + */ |
| 212 | +export const secondaryOpacity = () => { |
| 213 | + return <Facebook secondaryOpacity={0.06} /> |
| 214 | +} |
| 215 | + |
| 216 | +secondaryOpacity.story = { |
| 217 | + parameters: { |
| 218 | + notes: `## \`secondaryOpacity?: number\` |
| 219 | +
|
| 220 | + Defaults to \`1\`. Animation opacity (0 = transparent, 1 = opaque) used to solve a issue in [Safari](#bugfix-in-safari)`, |
| 221 | + }, |
| 222 | +} |
| 223 | + |
| 224 | +/** |
| 225 | + * Unique key |
| 226 | + */ |
| 227 | +export const uniqueKey = () => { |
| 228 | + return <Facebook uniquekey="my-uniqye-key" /> |
| 229 | +} |
| 230 | + |
| 231 | +uniqueKey.story = { |
| 232 | + parameters: { |
| 233 | + notes: `## \`uniquekey?: string\` |
| 234 | + |
| 235 | + Defaults to random unique id. Use the same value of prop key, that will solve inconsistency on the SSR, see more [here](https://github.com/danilowoz/react-content-loader/issues/78).`, |
| 236 | + }, |
| 237 | +} |
| 238 | + |
| 239 | +/** |
| 240 | + * View box |
| 241 | + */ |
| 242 | +// export const viewBox = () => { |
| 243 | +// return <Facebook viewBox="" /> |
| 244 | +// } |
| 245 | + |
| 246 | +// viewBox.story = { |
| 247 | +// parameters: { |
| 248 | +// notes: `## \`viewBox?: string\` |
| 249 | + |
| 250 | +// Use viewbox props to set viewbox value. |
| 251 | +// Additionally, pass viewBox props as empty string to remove viewBox.`, |
| 252 | +// }, |
| 253 | +// } |
0 commit comments