Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore(Skeleton): Adding demo to match core #10050

Open
wants to merge 1 commit into
base: v5
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/react-core/src/demos/Skeleton.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
id: Skeleton
section: components
---

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you'll want to add the import { DashboardWrapper } from '@patternfly/react-core/src/demos/DashboardWrapper'; import statement to the top of this markdown file and that should fix the docs build

## Demos

### Skeleton card

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

```
52 changes: 52 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,52 @@
import React from 'react';
import {
Gallery,
Flex,
PageSection,
PageSectionVariants,
TextContent,
Text,
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 />
<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 />
<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>
<PageSection variant={PageSectionVariants.light}>
<TextContent>
<Text component="h1">Main title</Text>
<Text component="p">This is a full page demo.</Text>
</TextContent>
</PageSection>
<PageSection>
<Gallery hasGutter>{Array.from({ length: 7 }).map((_value, index) => card(index))}</Gallery>
</PageSection>
</DashboardWrapper>
);
};
Loading