From a4720fc2e31ea4a835f355fb95dc33a2ca5bbe31 Mon Sep 17 00:00:00 2001 From: Vladimir Volek Date: Tue, 28 Aug 2018 16:27:59 +0200 Subject: [PATCH] Refactored notification buttons --- src/components/Button/index.js | 12 ++--- src/components/Notification/index.js | 79 ++++++++++++++++++++-------- src/styles/notification.less | 39 -------------- 3 files changed, 63 insertions(+), 67 deletions(-) diff --git a/src/components/Button/index.js b/src/components/Button/index.js index 15642eb1..05929e93 100644 --- a/src/components/Button/index.js +++ b/src/components/Button/index.js @@ -29,7 +29,7 @@ const Wrapper = styled.button` background: ${colors.GRAY_LIGHT}; `} - ${props => props.isBlue && css` + ${props => props.color === 'blue' && css` background: transparent; border: 1px solid ${colors.INFO_PRIMARY}; color: ${colors.INFO_PRIMARY}; @@ -41,8 +41,8 @@ const Wrapper = styled.button` } `} - ${props => props.isWhite && css` - background: @color_white; + ${props => props.color === 'white' && css` + background: ${colors.WHITE}; color: ${colors.TEXT_SECONDARY}; border: 1px solid ${colors.DIVIDER}; @@ -125,14 +125,14 @@ const IconWrapper = styled.span` `; const Button = ({ - className, text, icon, onClick = () => { }, disabled, isBlue = false, isWhite = false, isWebUsb = false, isTransparent = false, + className, text, icon, onClick = () => { }, disabled, color = null, isWhite = false, isWebUsb = false, isTransparent = false, }) => ( props.type === 'info' && css` + color: ${colors.INFO_PRIMARY}; + background: ${colors.INFO_SECONDARY}; + `} + + ${props => props.type === 'success' && css` + color: ${colors.SUCCESS_PRIMARY}; + background: ${colors.SUCCESS_SECONDARY}; + `} + + ${props => props.type === 'warning' && css` + color: ${colors.WARNING_PRIMARY}; + background: ${colors.WARNING_SECONDARY}; + `} + + ${props => props.type === 'error' && css` + color: ${colors.ERROR_PRIMARY}; + background: ${colors.ERROR_SECONDARY}; + `} +`; + +const Body = styled.div` + flex: 1; + margin-right: 24px; `; +const ActionContent = styled.div` +`; + +const CloseClick = styled.div``; + export const Notification = (props: NProps): React$Element => { - const className = `notification ${props.className}`; const close: Function = typeof props.close === 'function' ? props.close : () => {}; // TODO: add default close action const actionButtons = props.actions ? props.actions.map((a, i) => ( )) : null; return ( - - { props.cancelable ? ( -