Skip to content

Commit b8d7440

Browse files
Chore(Skeleton): Adding demo to match core (#11415)
* Chore(Skeleton): Adding demo to match core * Fixes formatting * Adds screenreaderText to Skeleton
1 parent 1ccc691 commit b8d7440

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
id: Skeleton
3+
section: components
4+
---
5+
import { DashboardWrapper } from '@patternfly/react-core/dist/js/demos/DashboardWrapper';
6+
7+
## Demos
8+
9+
### Skeleton card
10+
11+
```ts file='./examples/Skeleton/SkeletonCard.tsx' isFullscreen
12+
13+
```
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import React from 'react';
2+
import { Gallery, Flex, PageSection, Content, Card, CardBody, Skeleton } from '@patternfly/react-core';
3+
import { DashboardWrapper } from '@patternfly/react-core/src/demos/DashboardWrapper';
4+
5+
export const SkeletonCard: React.FunctionComponent = () => {
6+
const card = (index: number) => (
7+
<Card key={index} isCompact>
8+
<CardBody>
9+
<Flex direction={{ default: 'column' }} spacer={{ default: 'spacerMd' }}>
10+
<Skeleton screenreaderText="Loading content" />
11+
<Skeleton width="66%" screenreaderText="Loaded 66% of content" />
12+
<Skeleton width="25%" screenreaderText="Loaded 25% of content" />
13+
<Skeleton width="50%" screenreaderText="Loaded 50% of content" />
14+
</Flex>
15+
</CardBody>
16+
<CardBody>
17+
<Skeleton shape="square" width="75%" screenreaderText="Loading medium square contents" />
18+
</CardBody>
19+
<CardBody>
20+
<Flex direction={{ default: 'column' }} spacer={{ default: 'spacerMd' }}>
21+
<Skeleton screenreaderText="Loading content" />
22+
<Skeleton width="25%" screenreaderText="Loaded 25% of content" />
23+
<Skeleton width="75%" screenreaderText="Loaded 75% of content" />
24+
<Skeleton width="50%" screenreaderText="Loaded 50% of content" />
25+
</Flex>
26+
</CardBody>
27+
</Card>
28+
);
29+
return (
30+
<DashboardWrapper isBreadcrumbWidthLimited>
31+
<PageSection isWidthLimited>
32+
<Content component="h1">Main title</Content>
33+
<Content component="p">This is a full page demo.</Content>
34+
</PageSection>
35+
<PageSection>
36+
<Gallery hasGutter>{Array.from({ length: 7 }).map((_value, index) => card(index))}</Gallery>
37+
</PageSection>
38+
</DashboardWrapper>
39+
);
40+
};

0 commit comments

Comments
 (0)