From 75e010f3fb4307b99ab2132353f8cb17b17af33e Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Mon, 7 Dec 2015 14:31:18 +0100 Subject: [PATCH] Fix global notifications not showing initial transition --- js/components/global_notification.js | 39 +++++++++++++++------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/js/components/global_notification.js b/js/components/global_notification.js index 990e2d32..c1477f67 100644 --- a/js/components/global_notification.js +++ b/js/components/global_notification.js @@ -59,19 +59,22 @@ let GlobalNotification = React.createClass({ notificationsPaused, containerWidth } = this.state; - if (notification && !notificationsPaused) { - const notificationClasses = []; - let textClass; + const notificationClasses = []; - if (this.state.containerWidth > 768) { - notificationClasses.push('ascribe-global-notification-bubble'); - notificationClasses.push(notificationStatus === 'show' ? 'ascribe-global-notification-bubble-on' - : 'ascribe-global-notification-bubble-off'); - } else { - notificationClasses.push('ascribe-global-notification'); - notificationClasses.push(notificationStatus === 'show' ? 'ascribe-global-notification-on' - : 'ascribe-global-notification-off'); - } + if (this.state.containerWidth > 768) { + notificationClasses.push('ascribe-global-notification-bubble'); + notificationClasses.push(notificationStatus === 'show' ? 'ascribe-global-notification-bubble-on' + : 'ascribe-global-notification-bubble-off'); + } else { + notificationClasses.push('ascribe-global-notification'); + notificationClasses.push(notificationStatus === 'show' ? 'ascribe-global-notification-on' + : 'ascribe-global-notification-off'); + } + + let textClass; + let message; + if (notification && !notificationsPaused) { + message = notification.message; switch(notification.type) { case 'success': @@ -83,13 +86,13 @@ let GlobalNotification = React.createClass({ default: console.warn('Could not find a matching notification type in global_notification.js'); } - - return ( -
-
{notification.message}
-
- ); } + + return ( +
+
{message}
+
+ ); }, render() {