Skip to content

Commit

Permalink
Fix existing design flaws by using flex
Browse files Browse the repository at this point in the history
Incorporate flexbox design in the existing design of toolbar.

Resolves mui#3192
  • Loading branch information
tintin1343 authored and Cuong Le committed Mar 22, 2016
1 parent 35f99d7 commit a0948a6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default class ToolbarExamplesSimple extends React.Component {
render() {
return (
<Toolbar>
<ToolbarGroup firstChild={true} float="left">
<ToolbarGroup firstChild={true}>
<DropDownMenu value={this.state.value} onChange={this.handleChange}>
<MenuItem value={1} primaryText="All Broadcasts" />
<MenuItem value={2} primaryText="All Voice" />
Expand All @@ -36,9 +36,11 @@ export default class ToolbarExamplesSimple extends React.Component {
<MenuItem value={7} primaryText="Active Text" />
</DropDownMenu>
</ToolbarGroup>
<ToolbarGroup float="right">
<ToolbarTitle text="Options" style={{width: 90}} />
<ToolbarGroup>
<ToolbarTitle text="Options" />
<FontIcon className="muidocs-icon-custom-sort" />
<ToolbarSeparator />
<RaisedButton label="Create Broadcast" primary={true} />
<IconMenu
iconButtonElement={
<IconButton touch={true}>
Expand All @@ -49,8 +51,6 @@ export default class ToolbarExamplesSimple extends React.Component {
<MenuItem primaryText="Download" />
<MenuItem primaryText="More Info" />
</IconMenu>
<ToolbarSeparator />
<RaisedButton label="Create Broadcast" primary={true} />
</ToolbarGroup>
</Toolbar>
);
Expand Down
12 changes: 4 additions & 8 deletions src/toolbar/toolbar-group.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import getMuiTheme from '../styles/getMuiTheme';
function getStyles(props, state) {
const {
firstChild,
float,
lastChild,
} = props;

Expand All @@ -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,
Expand All @@ -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`,
Expand All @@ -57,7 +55,6 @@ function getStyles(props, state) {
},
},
span: {
float: 'left',
color: toolbar.iconColor,
lineHeight: `${toolbar.height}px`,
},
Expand Down Expand Up @@ -112,7 +109,6 @@ const ToolbarGroup = React.createClass({
getDefaultProps() {
return {
firstChild: false,
float: 'left',
lastChild: false,
};
},
Expand Down
1 change: 0 additions & 1 deletion src/toolbar/toolbar-title.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
3 changes: 2 additions & 1 deletion src/toolbar/toolbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
};
}
Expand Down

0 comments on commit a0948a6

Please sign in to comment.