From be647527cba9fc715ca77da3233eac4575a902fe Mon Sep 17 00:00:00 2001 From: Sriram Viswanathan Date: Tue, 28 Mar 2017 17:10:37 -0300 Subject: [#931] Adds support for multi-line Snackbar messages --- .../snackbar_notification/snackbar_notification.js | 13 ++++++++----- .../snackbar_notification.scss | 22 ++++++++++++++++++++++ .../snackbar_notification.spec.js | 2 +- 3 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 web-ui/src/common/snackbar_notification/snackbar_notification.scss (limited to 'web-ui') diff --git a/web-ui/src/common/snackbar_notification/snackbar_notification.js b/web-ui/src/common/snackbar_notification/snackbar_notification.js index 2aee3d67..8a7e5094 100644 --- a/web-ui/src/common/snackbar_notification/snackbar_notification.js +++ b/web-ui/src/common/snackbar_notification/snackbar_notification.js @@ -19,10 +19,13 @@ import React from 'react'; import Snackbar from 'material-ui/Snackbar'; import { red500, blue500 } from 'material-ui/styles/colors'; +import './snackbar_notification.scss'; + const notificationStyle = () => ({ top: 0, + left: 'auto', bottom: 'auto', - left: (window.innerWidth - 288) / 2, + alignSelf: 'center', transform: 'translate3d(0, 0px, 0)' }); @@ -31,14 +34,14 @@ const contentStyle = { }; const getStyleByType = (isError) => { - if (isError) { - return { backgroundColor: red500 }; - } - return { backgroundColor: blue500 }; + const style = { height: 'auto' }; + style.backgroundColor = isError ? red500 : blue500; + return style; }; const SnackbarNotification = ({ message, isError = false, autoHideDuration = 5000 }) => ( . + */ + +//TODO: Refer to Issue - https://github.com/callemall/material-ui/issues/3860 +#snackbar > div { + line-height: 20px !important; + padding: 24px !important; +} diff --git a/web-ui/src/common/snackbar_notification/snackbar_notification.spec.js b/web-ui/src/common/snackbar_notification/snackbar_notification.spec.js index 59461413..24b79e71 100644 --- a/web-ui/src/common/snackbar_notification/snackbar_notification.spec.js +++ b/web-ui/src/common/snackbar_notification/snackbar_notification.spec.js @@ -22,7 +22,7 @@ describe('SnackbarNotification', () => { it('renders snackbar with error body style', () => { expect(snackbarNotification.find(Snackbar).props().bodyStyle) - .toEqual({ backgroundColor: red500 }); + .toEqual({ height: 'auto', backgroundColor: red500 }); }); it('renders snackbar with default auto-hide duration', () => { -- cgit v1.2.3