diff options
author | Sriram Viswanathan <sriramv@thoughtworks.com> | 2017-03-28 17:10:37 -0300 |
---|---|---|
committer | Sriram Viswanathan <sriramv@thoughtworks.com> | 2017-03-28 17:10:37 -0300 |
commit | be647527cba9fc715ca77da3233eac4575a902fe (patch) | |
tree | fa20ceeae4e7d6a13aafb718b252e19735366737 /web-ui/src/common | |
parent | 6f9de40da695e5701104788e3216996b7950087d (diff) |
[#931] Adds support for multi-line Snackbar messages
Diffstat (limited to 'web-ui/src/common')
3 files changed, 31 insertions, 6 deletions
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 }) => ( <Snackbar + id='snackbar' open bodyStyle={getStyleByType(isError)} message={message} diff --git a/web-ui/src/common/snackbar_notification/snackbar_notification.scss b/web-ui/src/common/snackbar_notification/snackbar_notification.scss new file mode 100644 index 00000000..e37ba4ae --- /dev/null +++ b/web-ui/src/common/snackbar_notification/snackbar_notification.scss @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2017 ThoughtWorks, Inc. + * + * Pixelated is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Pixelated is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Pixelated. If not, see <http://www.gnu.org/licenses/>. + */ + +//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', () => { |