From ce40e3d96f6b716adf6fd968f14f5c02aeb0e57d Mon Sep 17 00:00:00 2001 From: meriadec Date: Thu, 25 Jan 2018 09:26:21 +0100 Subject: [PATCH] Add side margin to modals by default and minor styles updates --- src/components/SideBar/index.js | 2 +- src/components/base/Modal/index.js | 15 +++++++++------ src/components/base/Modal/stories.js | 2 ++ src/styles/theme.js | 3 +++ 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/components/SideBar/index.js b/src/components/SideBar/index.js index 07da6439..df8e832b 100644 --- a/src/components/SideBar/index.js +++ b/src/components/SideBar/index.js @@ -30,7 +30,7 @@ const Container = styled(Box).attrs({ noShrink: true, })` background-color: ${p => rgba(p.theme.colors[p.bg], process.platform === 'darwin' ? 0.4 : 1)}; - width: 250px; + width: ${p => p.theme.sizes.sideBarWidth}px; ` const BtnAddAccount = styled(Box).attrs({ diff --git a/src/components/base/Modal/index.js b/src/components/base/Modal/index.js index a368900e..a201acd9 100644 --- a/src/components/base/Modal/index.js +++ b/src/components/base/Modal/index.js @@ -20,7 +20,8 @@ import Box from 'components/base/Box' type Props = { isOpened?: boolean, onClose: Function, - preventBackdropClick: boolean, + preventBackdropClick?: boolean, + preventSideMargin?: boolean, render: Function, } @@ -73,13 +74,14 @@ const Wrapper = styled(Box).attrs({ transform: `translate3d(0, ${p.offset}px, 0)`, }), })` - width: 430px; + margin-left: ${p => (p.preventSideMargin ? 0 : p.theme.sizes.sideBarWidth)}px; + width: 570px; z-index: 2; ` const Body = styled(Box).attrs({ bg: p => p.theme.colors.white, - p: 20, + p: 3, })` border-radius: 5px; ` @@ -87,12 +89,13 @@ const Body = styled(Box).attrs({ export class Modal extends PureComponent { static defaultProps = { onClose: noop, - preventBackdropClick: true, + preventBackdropClick: false, + preventSideMargin: false, isOpened: false, } render() { - const { preventBackdropClick, isOpened, onClose, render } = this.props + const { preventBackdropClick, preventSideMargin, isOpened, onClose, render } = this.props return ( { {(m, isVisible) => ( - + {render({ onClose })} diff --git a/src/components/base/Modal/stories.js b/src/components/base/Modal/stories.js index 09eb8217..6abd2d47 100644 --- a/src/components/base/Modal/stories.js +++ b/src/components/base/Modal/stories.js @@ -8,9 +8,11 @@ const stories = storiesOf('Modal', module) stories.add('basic', () => { const isOpened = boolean('isOpened', true) + const preventSideMargin = boolean('preventSideMargin', true) return ( ( Hey! diff --git a/src/styles/theme.js b/src/styles/theme.js index a5805549..36234024 100644 --- a/src/styles/theme.js +++ b/src/styles/theme.js @@ -1,6 +1,9 @@ // @flow export default { + sizes: { + sideBarWidth: 250, + }, colors: { black: '#000000', white: '#ffffff',