diff --git a/.changeset/perfect-beers-explode.md b/.changeset/perfect-beers-explode.md new file mode 100644 index 0000000000..3045ca7f12 --- /dev/null +++ b/.changeset/perfect-beers-explode.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-notifications': patch +--- + +Increase default and allow modifying notification snackbar auto hide duration diff --git a/plugins/notifications/api-report.md b/plugins/notifications/api-report.md index 3699aa1bb0..9240bdb1c2 100644 --- a/plugins/notifications/api-report.md +++ b/plugins/notifications/api-report.md @@ -102,6 +102,7 @@ export const NotificationsSidebarItem: (props?: { webNotificationsEnabled?: boolean; titleCounterEnabled?: boolean; snackbarEnabled?: boolean; + snackbarAutoHideDuration?: number | null; className?: string; icon?: IconComponent; text?: string; diff --git a/plugins/notifications/src/components/NotificationsSideBarItem/NotificationsSideBarItem.tsx b/plugins/notifications/src/components/NotificationsSideBarItem/NotificationsSideBarItem.tsx index 000eabcae6..7b55c63747 100644 --- a/plugins/notifications/src/components/NotificationsSideBarItem/NotificationsSideBarItem.tsx +++ b/plugins/notifications/src/components/NotificationsSideBarItem/NotificationsSideBarItem.tsx @@ -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); } }) @@ -216,6 +220,7 @@ export const NotificationsSidebarItem = (props?: { sendWebNotification, webNotificationsEnabled, snackbarEnabled, + snackbarAutoHideDuration, notificationsApi, alertApi, getSnackbarProperties,