-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from patternfly/EmptyStateErrorMessage
feat: add EmptyStateErrorMessage and update a11y test dependency
- Loading branch information
Showing
8 changed files
with
1,036 additions
and
173 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
32 changes: 32 additions & 0 deletions
32
...tternfly-docs/content/examples/EmptyStateErrorMessage/EmptyStateErrorMessage.md
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,32 @@ | ||
--- | ||
# Sidenav top-level section | ||
# should be the same for all markdown files | ||
section: AI-infra-ui-components | ||
# Sidenav secondary level section | ||
# should be the same for all markdown files | ||
id: EmptyStateErrorMessage | ||
# Tab (react | react-demos | html | html-demos | design-guidelines | accessibility) | ||
source: react | ||
# If you use typescript, the name of the interface to display props for | ||
# These are found through the sourceProps function provided in patternfly-docs.source.js | ||
propComponents: ['EmptyStateErrorMessage'] | ||
--- | ||
|
||
import { EmptyStateErrorMessage } from "@patternfly/ai-infra-ui-components"; | ||
import { DrumstickBiteIcon } from '@patternfly/react-icons'; | ||
|
||
Note: this component documents the API and enhances the [existing EmptyStateErrorMessage](https://github.com/opendatahub-io/odh-dashboard/blob/main/frontend/src/components/EmptyStateErrorMessage.tsx) component from odh-dashboard. It can be imported from [@patternfly/ai-infra-ui-components](https://www.npmjs.com/package/@patternfly/AI-infra-ui-components). Alternatively, it can be used within the odh-dashboard via the import: `~/components/EmptyStateErrorMessage` | ||
|
||
### Basic | ||
|
||
```js file="./EmptyStateErrorMessageBasic.tsx" | ||
|
||
``` | ||
|
||
### Customization | ||
|
||
All properties of PatternFly's [empty state component](https://www.patternfly.org/components/empty-state) are spread to the error state component group. | ||
|
||
```js file="./EmptyStateErrorMessageCustomized.tsx" | ||
|
||
``` |
11 changes: 11 additions & 0 deletions
11
...e/patternfly-docs/content/examples/EmptyStateErrorMessage/EmptyStateErrorMessageBasic.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,11 @@ | ||
import * as React from 'react'; | ||
import { EmptyStateErrorMessage } from "@patternfly/ai-infra-ui-components"; | ||
|
||
export const EmptyStateErrorMessageBasic: React.FunctionComponent = () => ( | ||
<EmptyStateErrorMessage | ||
title="Error loading workloads" | ||
bodyText="Check your network connection." | ||
> | ||
Reach out for more assistance. | ||
</EmptyStateErrorMessage> | ||
); |
13 changes: 13 additions & 0 deletions
13
...ternfly-docs/content/examples/EmptyStateErrorMessage/EmptyStateErrorMessageCustomized.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,13 @@ | ||
import * as React from 'react'; | ||
import { EmptyStateErrorMessage } from "@patternfly/ai-infra-ui-components"; | ||
import { DrumstickBiteIcon } from '@patternfly/react-icons'; | ||
|
||
export const EmptyStateErrorMessageBasic: React.FunctionComponent = () => ( | ||
<EmptyStateErrorMessage | ||
title="Error loading workloads" | ||
bodyText="Check your network connection." | ||
icon={DrumstickBiteIcon} | ||
headingLevel="h3" | ||
status="info" | ||
/> | ||
); |
30 changes: 30 additions & 0 deletions
30
packages/module/src/EmptyStateErrorMessage/EmptyStateErrorMessage.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,30 @@ | ||
import * as React from 'react'; | ||
import ErrorState from "@patternfly/react-component-groups/dist/dynamic/ErrorState"; | ||
import { EmptyStateProps } from '@patternfly/react-core'; | ||
import { PathMissingIcon } from '@patternfly/react-icons'; | ||
|
||
export type EmptyStateErrorMessageProps = { | ||
/** Optional content to be rendered at the bottom of the error message. */ | ||
children?: React.ReactNode; | ||
/** Content to be rendered as the Title of the error message, below the image. */ | ||
title?: string; | ||
/** Content to be rendered as the description of the error below the title. */ | ||
bodyText?: string; | ||
} & Omit<EmptyStateProps, 'children' | 'titleText'>; | ||
|
||
export const EmptyStateErrorMessage: React.FunctionComponent<EmptyStateErrorMessageProps> = ({ | ||
title, | ||
bodyText, | ||
children, | ||
...props | ||
}: EmptyStateErrorMessageProps) => ( | ||
<ErrorState | ||
titleText={title} | ||
bodyText={bodyText} | ||
headingLevel='h2' | ||
icon={PathMissingIcon} | ||
status="none" | ||
customFooter={children || <div></div>} | ||
{...props} | ||
/> | ||
); |
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 @@ | ||
export * from './EmptyStateErrorMessage'; |
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
Oops, something went wrong.