From a7726081f2435a2eaea04253547794a22ef05c89 Mon Sep 17 00:00:00 2001 From: Vladimir Volek Date: Wed, 29 Aug 2018 13:54:41 +0200 Subject: [PATCH] Separted button and notfication button --- src/components/Button/index.js | 36 -------- src/components/Notification/index.js | 44 ++++------ src/components/NotificationButton/index.js | 98 ++++++++++++++++++++++ src/styles/index.less | 2 - src/styles/notification.less | 68 --------------- src/views/Wallet/views/Dashboard/index.js | 42 ++++++++++ 6 files changed, 156 insertions(+), 134 deletions(-) create mode 100644 src/components/NotificationButton/index.js delete mode 100644 src/styles/notification.less diff --git a/src/components/Button/index.js b/src/components/Button/index.js index f4635573..876fe893 100644 --- a/src/components/Button/index.js +++ b/src/components/Button/index.js @@ -29,42 +29,6 @@ const Wrapper = styled.button` background: ${colors.GRAY_LIGHT}; `} - ${props => props.color === 'blue' && css` - background: transparent; - border: 1px solid ${colors.INFO_PRIMARY}; - color: ${colors.INFO_PRIMARY}; - padding: 12px 58px; - - &:hover { - color: ${colors.WHITE}; - background: ${colors.INFO_PRIMARY}; - } - `} - - ${props => props.color === 'red' && css` - background: transparent; - border: 1px solid ${colors.ERROR_PRIMARY}; - color: ${colors.ERROR_SECONDARY}; - padding: 12px 58px; - - &:hover { - color: ${colors.WHITE}; - background: ${colors.ERROR_PRIMARY}; - } - `} - - ${props => props.color === 'orange' && css` - background: transparent; - border: 1px solid ${colors.WARNING_PRIMARY}; - color: ${colors.WARNING_SECONDARY}; - padding: 12px 58px; - - &:hover { - color: ${colors.WHITE}; - background: ${colors.WARNING_PRIMARY}; - } - `} - ${props => props.color === 'white' && css` background: ${colors.WHITE}; color: ${colors.TEXT_SECONDARY}; diff --git a/src/components/Notification/index.js b/src/components/Notification/index.js index eb5e6e4b..adbdf83c 100644 --- a/src/components/Notification/index.js +++ b/src/components/Notification/index.js @@ -3,7 +3,7 @@ import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import styled, { css } from 'styled-components'; import colors from 'config/colors'; -import Button from 'components/Button'; +import NotificationButton from 'components/NotificationButton'; import Icon from 'components/Icon'; import icons from 'config/icons'; import { FONT_SIZE, FONT_WEIGHT } from 'config/variables'; @@ -55,7 +55,13 @@ const Title = styled.div` `; const ActionContent = styled.div``; -const CloseClick = styled.div``; + +const CloseClick = styled.div` + position: absolute; + right: 0; + top: 0; + padding: 20px 10px 0 0; +`; const Message = styled.div` padding: 5px 0 0 0; @@ -68,7 +74,7 @@ const IconContent = styled.div` const StyledIcon = styled(Icon)` position: relative; - top: -6px; + top: -7px; `; const MessageContent = styled.div``; @@ -76,28 +82,6 @@ const MessageContent = styled.div``; export const Notification = (props: NProps): React$Element => { const close: Function = typeof props.close === 'function' ? props.close : () => {}; // TODO: add default close action - const getButtonColor = (type) => { - let color; - switch (type) { - case 'info': - color = 'blue'; - break; - case 'error': - color = 'red'; - break; - case 'warning': - color = 'orange'; - break; - case 'success': - color = 'green'; - break; - default: - color = null; - } - - return color; - }; - const getIconColor = (type) => { let color; switch (type) { @@ -125,7 +109,11 @@ export const Notification = (props: NProps): React$Element => { {props.loading && } {props.cancelable && ( close()}> - + )} @@ -148,9 +136,9 @@ export const Notification = (props: NProps): React$Element => { {props.actions .map(action => ( -