Skip to content

Commit

Permalink
feat(notification) add docs for the NotificationProvider, useNotify a…
Browse files Browse the repository at this point in the history
…nd NotificationConsumer WD-5366
  • Loading branch information
edlerd committed Sep 11, 2023
1 parent 5e804d8 commit 1433cfc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/components/Notification/Notification.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ This is a [React](https://reactjs.org/) component for the Vanilla [Notification]

Notifications are used to display global information, our notification variants consist of default, caution, negative or positive.

The `NotificationProvider` component can be used to manage the notification state globally. Wrap your application components with it and then in any child component you can get the helper with `const notify = useNotify()` to easily trigger notifications:

- `notify.info("You should keep this in mind")`
- `notify.failure("Error when fooing a bar", errorObjectFromCatch)`
- `notify.success("The bar was foo'd", "Success")`

The `NotificationConsumer` component can be used to display notifications. It will automatically display any notifications that are added to the `NotificationProvider` state.

### Props

<ArgsTable of={Notification} />
Expand Down

0 comments on commit 1433cfc

Please sign in to comment.