|
| 1 | +import React from 'react' |
| 2 | +import { ThemeProvider, Stack, Skeleton, Link, Text } from 'react-ui' |
| 3 | +import { Page, Props, Example, Section, Table, Para } from '../../components' |
| 4 | + |
| 5 | +const Documentation = () => { |
| 6 | + return ( |
| 7 | + <Page |
| 8 | + title="Skeleton" |
| 9 | + tagline="Use a skeleton to hint that some content is on it's way" |
| 10 | + > |
| 11 | + <Example> |
| 12 | + <Example.Preview direction="vertical" gap={2}> |
| 13 | + <Skeleton /> |
| 14 | + </Example.Preview> |
| 15 | + <Example.Code> |
| 16 | + {` |
| 17 | + <Skeleton /> |
| 18 | + `} |
| 19 | + </Example.Code> |
| 20 | + </Example> |
| 21 | + |
| 22 | + <Section title="Props"> |
| 23 | + <Props |
| 24 | + props={[ |
| 25 | + { |
| 26 | + name: 'width', |
| 27 | + type: 'number', |
| 28 | + description: 'width of skeleton', |
| 29 | + default: 200 |
| 30 | + } |
| 31 | + ]} |
| 32 | + /> |
| 33 | + </Section> |
| 34 | + |
| 35 | + <Section title="Examples"> |
| 36 | + <Example title="Width"> |
| 37 | + <Example.Preview> |
| 38 | + <Stack direction="vertical" gap={2}> |
| 39 | + <Skeleton /> |
| 40 | + <Skeleton width={120} /> |
| 41 | + </Stack> |
| 42 | + </Example.Preview> |
| 43 | + <Example.Code>{` |
| 44 | + <Skeleton /> |
| 45 | + <Skeleton width={120} /> |
| 46 | + `}</Example.Code> |
| 47 | + </Example> |
| 48 | + </Section> |
| 49 | + |
| 50 | + <Section title="Customisation"> |
| 51 | + <Para> |
| 52 | + <Text variant="subtle" css={{ fontStyle: 'italic' }}> |
| 53 | + Please read the docs on{' '} |
| 54 | + <Link href="/core-concepts/customising-components"> |
| 55 | + customising components |
| 56 | + </Link>{' '} |
| 57 | + first. |
| 58 | + </Text> |
| 59 | + </Para> |
| 60 | + |
| 61 | + <Para> |
| 62 | + <Text>Skeleton uses the following properties from theme:</Text> |
| 63 | + </Para> |
| 64 | + |
| 65 | + <Table> |
| 66 | + <Table.Header> |
| 67 | + <Table.Column span={6}>Property</Table.Column> |
| 68 | + <Table.Column span={6}>Theme key</Table.Column> |
| 69 | + </Table.Header> |
| 70 | + <Table.Row> |
| 71 | + <Table.Column span={6}>component name</Table.Column> |
| 72 | + <Table.Column span={6}>Skeleton</Table.Column> |
| 73 | + </Table.Row> |
| 74 | + <Table.Row> |
| 75 | + <Table.Column span={6}>colors</Table.Column> |
| 76 | + <Table.Column span={6}> |
| 77 | + backgroundColor + highlightColor |
| 78 | + </Table.Column> |
| 79 | + </Table.Row> |
| 80 | + </Table> |
| 81 | + |
| 82 | + <Example> |
| 83 | + <Example.Code lang="js">{` |
| 84 | + import { tokens, components } from 'react-ui/themes/base' |
| 85 | +
|
| 86 | + // extend components |
| 87 | + components.Skeleton = { |
| 88 | + backgroundColor: 'lightgrey', |
| 89 | + highlightColor: 'white', |
| 90 | + height: 4, |
| 91 | + borderRadius: 2, |
| 92 | + animationDuration: 8 |
| 93 | + } |
| 94 | + `}</Example.Code> |
| 95 | + <Example.Code lang="jsx">{` |
| 96 | + <ThemeProvider tokens={tokens} components={components}> |
| 97 | + <Skeleton /> |
| 98 | + <Skeleton width={120} /> |
| 99 | + </ThemeProvider> |
| 100 | + `}</Example.Code> |
| 101 | + <Example.Preview direction="vertical" gap={2}> |
| 102 | + <ThemeProvider |
| 103 | + components={{ |
| 104 | + Skeleton: { |
| 105 | + backgroundColor: 'lightgrey', |
| 106 | + highlightColor: 'white', |
| 107 | + height: 4, |
| 108 | + borderRadius: 2, |
| 109 | + animationDuration: 8 |
| 110 | + } |
| 111 | + }} |
| 112 | + > |
| 113 | + <Skeleton /> |
| 114 | + <Skeleton width={120} /> |
| 115 | + </ThemeProvider> |
| 116 | + </Example.Preview> |
| 117 | + </Example> |
| 118 | + </Section> |
| 119 | + </Page> |
| 120 | + ) |
| 121 | +} |
| 122 | + |
| 123 | +export default Documentation |
0 commit comments