feat: increase default and allow changing snackbar auto hide duration

Signed-off-by: Heikki Hellgren <heikki.hellgren@op.fi>
This commit is contained in:
Heikki Hellgren
2024-05-03 12:27:52 +03:00
parent 21bef2ee5c
commit 42eaf63a75
3 changed files with 11 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-notifications': patch
---
Increase default and allow modifying notification snackbar auto hide duration
+1
View File
@@ -102,6 +102,7 @@ export const NotificationsSidebarItem: (props?: {
webNotificationsEnabled?: boolean;
titleCounterEnabled?: boolean;
snackbarEnabled?: boolean;
snackbarAutoHideDuration?: number | null;
className?: string;
icon?: IconComponent;
text?: string;
@@ -83,6 +83,7 @@ export const NotificationsSidebarItem = (props?: {
webNotificationsEnabled?: boolean;
titleCounterEnabled?: boolean;
snackbarEnabled?: boolean;
snackbarAutoHideDuration?: number | null;
className?: string;
icon?: IconComponent;
text?: string;
@@ -93,6 +94,7 @@ export const NotificationsSidebarItem = (props?: {
webNotificationsEnabled = false,
titleCounterEnabled = true,
snackbarEnabled = true,
snackbarAutoHideDuration = 10000,
icon = NotificationsIcon,
text = 'Notifications',
...restProps
@@ -100,6 +102,7 @@ export const NotificationsSidebarItem = (props?: {
webNotificationsEnabled: false,
titleCounterEnabled: true,
snackbarEnabled: true,
snackbarAutoHideDuration: 10000,
};
const { loading, error, value, retry } = useNotificationsApi(api =>
@@ -196,6 +199,7 @@ export const NotificationsSidebarItem = (props?: {
variant: notification.payload.severity,
anchorOrigin: { vertical: 'bottom', horizontal: 'right' },
action,
autoHideDuration: snackbarAutoHideDuration,
} as OptionsWithExtraProps<VariantType>);
}
})
@@ -216,6 +220,7 @@ export const NotificationsSidebarItem = (props?: {
sendWebNotification,
webNotificationsEnabled,
snackbarEnabled,
snackbarAutoHideDuration,
notificationsApi,
alertApi,
getSnackbarProperties,