Skip to content

Commit

Permalink
Chore(Skeleton): Adding demo to match core (#11415)
Browse files Browse the repository at this point in the history
* Chore(Skeleton): Adding demo to match core

* Fixes formatting

* Adds screenreaderText to Skeleton
  • Loading branch information
gabipodolnikova authored Jan 14, 2025
1 parent 1ccc691 commit b8d7440
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/react-core/src/demos/Skeleton.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
id: Skeleton
section: components
---
import { DashboardWrapper } from '@patternfly/react-core/dist/js/demos/DashboardWrapper';

## Demos

### Skeleton card

```ts file='./examples/Skeleton/SkeletonCard.tsx' isFullscreen

```
40 changes: 40 additions & 0 deletions packages/react-core/src/demos/examples/Skeleton/SkeletonCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React from 'react';
import { Gallery, Flex, PageSection, Content, Card, CardBody, Skeleton } from '@patternfly/react-core';
import { DashboardWrapper } from '@patternfly/react-core/src/demos/DashboardWrapper';

export const SkeletonCard: React.FunctionComponent = () => {
const card = (index: number) => (
<Card key={index} isCompact>
<CardBody>
<Flex direction={{ default: 'column' }} spacer={{ default: 'spacerMd' }}>
<Skeleton screenreaderText="Loading content" />
<Skeleton width="66%" screenreaderText="Loaded 66% of content" />
<Skeleton width="25%" screenreaderText="Loaded 25% of content" />
<Skeleton width="50%" screenreaderText="Loaded 50% of content" />
</Flex>
</CardBody>
<CardBody>
<Skeleton shape="square" width="75%" screenreaderText="Loading medium square contents" />
</CardBody>
<CardBody>
<Flex direction={{ default: 'column' }} spacer={{ default: 'spacerMd' }}>
<Skeleton screenreaderText="Loading content" />
<Skeleton width="25%" screenreaderText="Loaded 25% of content" />
<Skeleton width="75%" screenreaderText="Loaded 75% of content" />
<Skeleton width="50%" screenreaderText="Loaded 50% of content" />
</Flex>
</CardBody>
</Card>
);
return (
<DashboardWrapper isBreadcrumbWidthLimited>
<PageSection isWidthLimited>
<Content component="h1">Main title</Content>
<Content component="p">This is a full page demo.</Content>
</PageSection>
<PageSection>
<Gallery hasGutter>{Array.from({ length: 7 }).map((_value, index) => card(index))}</Gallery>
</PageSection>
</DashboardWrapper>
);
};

0 comments on commit b8d7440

Please sign in to comment.