From fe495345f828c9570b78056fdd5c89b798d6280c Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 7 Feb 2022 15:24:46 +0000 Subject: [PATCH] Update auto dismissal of notifications --- packages/bbui/src/Stores/notifications.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/bbui/src/Stores/notifications.js b/packages/bbui/src/Stores/notifications.js index f4e80dc8cc..640f8218c4 100644 --- a/packages/bbui/src/Stores/notifications.js +++ b/packages/bbui/src/Stores/notifications.js @@ -20,15 +20,18 @@ export const createNotificationStore = () => { setTimeout(() => (block = false), timeout) } - const send = (message, type = "default", icon = "", timeout = true) => { + const send = (message, type = "default", icon = "", autoDismiss = true) => { if (block) { return } let _id = id() _notifications.update(state => { - return [...state, { id: _id, type, message, icon, dismissable: !timeout }] + return [ + ...state, + { id: _id, type, message, icon, dismissable: !autoDismiss }, + ] }) - if (timeout) { + if (autoDismiss) { const timeoutId = setTimeout(() => { dismissNotification(_id) }, NOTIFICATION_TIMEOUT)