-
Notifications
You must be signed in to change notification settings - Fork 353
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chore(Skeleton): Adding demo to match core (#11415)
* Chore(Skeleton): Adding demo to match core * Fixes formatting * Adds screenreaderText to Skeleton
- Loading branch information
1 parent
1ccc691
commit b8d7440
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
40
packages/react-core/src/demos/examples/Skeleton/SkeletonCard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
}; |