diff --git a/packages/core/helper-plugin/lib/src/hooks/useNotification/useNotification.stories.mdx b/packages/core/helper-plugin/lib/src/hooks/useNotification/useNotification.stories.mdx new file mode 100644 index 0000000000..6507ef2bff --- /dev/null +++ b/packages/core/helper-plugin/lib/src/hooks/useNotification/useNotification.stories.mdx @@ -0,0 +1,48 @@ + + +import { Meta } from '@storybook/addon-docs'; + + + +# useNotification + +This component is used in order to apply RBAC to a view. If the user does not have the permissions to access the view he will be redirect to the homepage: + +## Usage + +``` +import { useNotification } from '@strapi/helper-plugin'; +import { Button, Main } from '@strapi/parts'; + +const HomePage = () => { + const toggleNotification = useNotification(); + + const handleClick = () => { + toggleNotification({ + // required + type: 'info|success|warning', + // required + message: { id: 'notification.version.update.message', defaultMessage: 'A new version is available' }, + // optional + link: { + url: 'https://github.com/strapi/strapi/releases/tag/v4', + label: { + id: 'notification.version.update.link', + defaultMessage: 'See more' + }, + }, + // optional: default = false + blockTransition: true, + // optional + onClose: () => localStorage.setItem('STRAPI_UPDATE_NOTIF', true), + }); + } + + return ( +
+

This is the homepage

+ +
+ ); +}; +```