|
| 1 | +import dedent from 'ts-dedent'; |
| 2 | +import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs'; |
| 3 | +import { SkeletonPage, Layout, LayoutSection, Card, TextContainer, SkeletonBodyText, SkeletonDisplayText, CardSection } from '@/polaris-vue'; |
| 4 | + |
| 5 | +<Meta |
| 6 | + title="Components / Feedback indicators / Skeleton page" |
| 7 | + component={ SkeletonPage } |
| 8 | + argTypes={{ |
| 9 | + }} |
| 10 | +/> |
| 11 | + |
| 12 | +export const Template = (args) => ({ |
| 13 | + components: { SkeletonPage, Layout, LayoutSection, Card, TextContainer, SkeletonBodyText, SkeletonDisplayText, CardSection }, |
| 14 | + setup() { |
| 15 | + return { args }; |
| 16 | + }, |
| 17 | + template: ` |
| 18 | + <SkeletonPage primaryAction> |
| 19 | + <Layout> |
| 20 | + <LayoutSection> |
| 21 | + <Card sectioned> |
| 22 | + <SkeletonBodyText /> |
| 23 | + </Card> |
| 24 | + <Card sectioned> |
| 25 | + <TextContainer> |
| 26 | + <SkeletonDisplayText size="small" /> |
| 27 | + <SkeletonBodyText /> |
| 28 | + </TextContainer> |
| 29 | + </Card> |
| 30 | + <Card sectioned> |
| 31 | + <TextContainer> |
| 32 | + <SkeletonDisplayText size="small" /> |
| 33 | + <SkeletonBodyText /> |
| 34 | + </TextContainer> |
| 35 | + </Card> |
| 36 | + </LayoutSection> |
| 37 | + <LayoutSection secondary> |
| 38 | + <Card> |
| 39 | + <CardSection> |
| 40 | + <TextContainer> |
| 41 | + <SkeletonDisplayText size="small" /> |
| 42 | + <SkeletonBodyText :lines="2" /> |
| 43 | + </TextContainer> |
| 44 | + </Card.Section> |
| 45 | + <CardSection> |
| 46 | + <SkeletonBodyText lines={1} /> |
| 47 | + </Card.Section> |
| 48 | + </Card> |
| 49 | + <Card subdued> |
| 50 | + <CardSection> |
| 51 | + <TextContainer> |
| 52 | + <SkeletonDisplayText size="small" /> |
| 53 | + <SkeletonBodyText :lines="2" /> |
| 54 | + </TextContainer> |
| 55 | + </CardSection> |
| 56 | + <CardSection> |
| 57 | + <SkeletonBodyText :lines="2" /> |
| 58 | + </CardSection> |
| 59 | + </Card> |
| 60 | + </LayoutSection> |
| 61 | + </Layout> |
| 62 | + </SkeletonPage> |
| 63 | + `, |
| 64 | +}); |
| 65 | + |
| 66 | +# Skeleton page |
| 67 | + |
| 68 | +Skeleton page is used with other skeleton loading components to provide a low fidelity representation of the user interface (UI) before content appears on the page. It improves load times perceived by merchants. |
| 69 | + |
| 70 | +<Canvas> |
| 71 | + <Story |
| 72 | + name="Skeleton page" |
| 73 | + parameters={{ |
| 74 | + docs: { |
| 75 | + source: { |
| 76 | + code: dedent` |
| 77 | + <SkeletonPage primaryAction> |
| 78 | + <Layout> |
| 79 | + <LayoutSection> |
| 80 | + <Card sectioned> |
| 81 | + <SkeletonBodyText /> |
| 82 | + </Card> |
| 83 | + <Card sectioned> |
| 84 | + <TextContainer> |
| 85 | + <SkeletonDisplayText size="small" /> |
| 86 | + <SkeletonBodyText /> |
| 87 | + </TextContainer> |
| 88 | + </Card> |
| 89 | + <Card sectioned> |
| 90 | + <TextContainer> |
| 91 | + <SkeletonDisplayText size="small" /> |
| 92 | + <SkeletonBodyText /> |
| 93 | + </TextContainer> |
| 94 | + </Card> |
| 95 | + </LayoutSection> |
| 96 | + <LayoutSection secondary> |
| 97 | + <Card> |
| 98 | + <CardSection> |
| 99 | + <TextContainer> |
| 100 | + <SkeletonDisplayText size="small" /> |
| 101 | + <SkeletonBodyText :lines="2" /> |
| 102 | + </TextContainer> |
| 103 | + </Card.Section> |
| 104 | + <CardSection> |
| 105 | + <SkeletonBodyText lines={1} /> |
| 106 | + </Card.Section> |
| 107 | + </Card> |
| 108 | + <Card subdued> |
| 109 | + <CardSection> |
| 110 | + <TextContainer> |
| 111 | + <SkeletonDisplayText size="small" /> |
| 112 | + <SkeletonBodyText :lines="2" /> |
| 113 | + </TextContainer> |
| 114 | + </CardSection> |
| 115 | + <CardSection> |
| 116 | + <SkeletonBodyText :lines="2" /> |
| 117 | + </CardSection> |
| 118 | + </Card> |
| 119 | + </LayoutSection> |
| 120 | + </Layout> |
| 121 | + </SkeletonPage> |
| 122 | + `, |
| 123 | + }, |
| 124 | + }, |
| 125 | + }} |
| 126 | + > |
| 127 | + {Template.bind({})} |
| 128 | + </Story> |
| 129 | +</Canvas> |
| 130 | + |
| 131 | +<ArgsTable story="Skeleton page"/> |
0 commit comments