From e2bec06ce045f32128ebfed972eb2c23a712b1c7 Mon Sep 17 00:00:00 2001 From: Nitin Shetty Date: Tue, 1 Mar 2016 13:55:16 -0600 Subject: [PATCH] Redesign toolbar using flexbox Incorporate flexbox design in the existing design of toolbar. Resolves callemall/material-ui#3192 --- .../pages/components/Toolbar/ExampleSimple.jsx | 10 +++++----- src/toolbar/toolbar-group.jsx | 12 ++++-------- src/toolbar/toolbar-title.jsx | 1 - src/toolbar/toolbar.jsx | 3 ++- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/docs/src/app/components/pages/components/Toolbar/ExampleSimple.jsx b/docs/src/app/components/pages/components/Toolbar/ExampleSimple.jsx index f3fa38c331712b..b8d104d01dd253 100644 --- a/docs/src/app/components/pages/components/Toolbar/ExampleSimple.jsx +++ b/docs/src/app/components/pages/components/Toolbar/ExampleSimple.jsx @@ -25,7 +25,7 @@ export default class ToolbarExamplesSimple extends React.Component { render() { return ( - + @@ -36,9 +36,11 @@ export default class ToolbarExamplesSimple extends React.Component { - - + + + + @@ -49,8 +51,6 @@ export default class ToolbarExamplesSimple extends React.Component { - - ); diff --git a/src/toolbar/toolbar-group.jsx b/src/toolbar/toolbar-group.jsx index ed88820401b603..606b9a1b2182b2 100644 --- a/src/toolbar/toolbar-group.jsx +++ b/src/toolbar/toolbar-group.jsx @@ -4,7 +4,6 @@ import getMuiTheme from '../styles/getMuiTheme'; function getStyles(props, state) { const { firstChild, - float, lastChild, } = props; @@ -19,17 +18,18 @@ function getStyles(props, state) { const styles = { root: { - float, position: 'relative', marginLeft: firstChild ? -marginHorizontal : undefined, marginRight: lastChild ? -marginHorizontal : undefined, + display: 'flex', + justifyContent: 'space-between', }, dropDownMenu: { root: { - float: 'left', color: toolbar.color, // removes hover color change, we want to keep it - display: 'inline-block', marginRight: baseTheme.spacing.desktopGutter, + flex: 1, + whiteSpace: 'nowrap', }, controlBg: { backgroundColor: toolbar.menuHoverColor, @@ -40,13 +40,11 @@ function getStyles(props, state) { }, }, button: { - float: 'left', margin: `${marginVertical}px ${marginHorizontal}px`, position: 'relative', }, icon: { root: { - float: 'left', cursor: 'pointer', color: toolbar.iconColor, lineHeight: `${toolbar.height}px`, @@ -57,7 +55,6 @@ function getStyles(props, state) { }, }, span: { - float: 'left', color: toolbar.iconColor, lineHeight: `${toolbar.height}px`, }, @@ -112,7 +109,6 @@ const ToolbarGroup = React.createClass({ getDefaultProps() { return { firstChild: false, - float: 'left', lastChild: false, }; }, diff --git a/src/toolbar/toolbar-title.jsx b/src/toolbar/toolbar-title.jsx index cbe418cdda1c7d..3f230f596649a5 100644 --- a/src/toolbar/toolbar-title.jsx +++ b/src/toolbar/toolbar-title.jsx @@ -12,7 +12,6 @@ function getStyles(props, state) { paddingRight: baseTheme.spacing.desktopGutterLess, lineHeight: `${toolbar.height}px`, fontSize: toolbar.titleFontSize, - display: 'inline-block', position: 'relative', textOverflow: 'ellipsis', whiteSpace: 'nowrap', diff --git a/src/toolbar/toolbar.jsx b/src/toolbar/toolbar.jsx index e0031430d68ef0..6d5b92efbb2346 100644 --- a/src/toolbar/toolbar.jsx +++ b/src/toolbar/toolbar.jsx @@ -17,8 +17,9 @@ function getStyles(props, state) { WebkitTapHighlightColor: 'rgba(0,0,0,0)', // Remove mobile color flashing (deprecated) backgroundColor: toolbar.backgroundColor, height: toolbar.height, - width: '100%', padding: noGutter ? 0 : `0px ${baseTheme.spacing.desktopGutter}px`, + display: 'flex', + justifyContent: 'space-between', }, }; }