You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/design-system/src/UserNotification.stories.mdx
+24Lines changed: 24 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,5 @@
1
1
importUserNotificationfrom'./UserNotification'
2
+
import { useState } from'react'
2
3
3
4
{/* START README */}
4
5
<divclassName="prose prose-sm max-w-none">
@@ -22,6 +23,9 @@ The UserNotification component accepts the following props:
22
23
-@param type - The type of the notification. This can be either 'success', 'info' or 'error'. This determines the icon that is displayed and some conditional styling. If not type is provided, the information icon is displayed.
23
24
-@param children - The optional children are displayed in the notification in addition to the provided message icon.
24
25
-@param className - The optional className object allows you to override the default styling.
26
+
-@param dismissible - If true, shows an X button in the top-right.
27
+
-@param hidden - If true, hides the notification (useful with dismissible).
28
+
-@param onDismiss - Callback when the X button is clicked.
* @param data - The object of data attributes that can be used for testing (e.g. data-test or data-cy)
43
48
* @param message - The message that is displayed in the notification.
44
49
* @param type - The type of the notification. This can be either 'success', 'info' or 'error'. This determines the icon that is displayed and some conditional styling. If not type is provided, the information icon is displayed.
50
+
* @param dismissible - If true, a close button is displayed in the top right corner of the notification. When clicked, the onDismiss function is called.
51
+
* @param hidden - If true, the notification is hidden. This can be used in combination with the dismissible prop to hide the notification when the close button is clicked.
52
+
* @param onDismiss - The function that is called when the close button is clicked. This prop is required if the dismissible prop is set to true.
45
53
* @param children - The optional children are displayed in the notification in addition to the provided message icon.
46
54
* @param className - The optional className object allows you to override the default styling.
47
55
* @returns UserNotification component
@@ -51,12 +59,19 @@ export function UserNotification({
* @param data - The object of data attributes that can be used for testing (e.g. data-test or data-cy)
3174
3174
* @param message - The message that is displayed in the notification.
3175
3175
* @param type - The type of the notification. This can be either 'success', 'info' or 'error'. This determines the icon that is displayed and some conditional styling. If not type is provided, the information icon is displayed.
3176
+
* @param dismissible - If true, a close button is displayed in the top right corner of the notification. When clicked, the onDismiss function is called.
3177
+
* @param hidden - If true, the notification is hidden. This can be used in combination with the dismissible prop to hide the notification when the close button is clicked.
3178
+
* @param onDismiss - The function that is called when the close button is clicked. This prop is required if the dismissible prop is set to true.
3176
3179
* @param children - The optional children are displayed in the notification in addition to the provided message icon.
3177
3180
* @param className - The optional className object allows you to override the default styling.
0 commit comments