Skip to content

Commit

Permalink
Redesign toolbar using flexbox
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 committed Mar 1, 2016
1 parent b0ca301 commit 99fef2a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 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
13 changes: 6 additions & 7 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,20 @@ function getStyles(props, state) {

const styles = {
root: {
float,
position: 'relative',
marginLeft: firstChild ? -marginHorizontal : undefined,
marginRight: lastChild ? -marginHorizontal : undefined,
display: 'flex',
justifyContent: 'space-between',
flexWrap: 'wrap',
},
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 +42,12 @@ function getStyles(props, state) {
},
},
button: {
float: 'left',
margin: `${marginVertical}px ${marginHorizontal}px`,
position: 'relative',
overflow: 'hidden',
},
icon: {
root: {
float: 'left',
cursor: 'pointer',
color: toolbar.iconColor,
lineHeight: `${toolbar.height}px`,
Expand All @@ -57,7 +58,6 @@ function getStyles(props, state) {
},
},
span: {
float: 'left',
color: toolbar.iconColor,
lineHeight: `${toolbar.height}px`,
},
Expand Down Expand Up @@ -112,7 +112,6 @@ const ToolbarGroup = React.createClass({
getDefaultProps() {
return {
firstChild: false,
float: 'left',
lastChild: false,
};
},
Expand Down
2 changes: 1 addition & 1 deletion src/toolbar/toolbar-title.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ function getStyles(props, state) {
paddingRight: baseTheme.spacing.desktopGutterLess,
lineHeight: `${toolbar.height}px`,
fontSize: toolbar.titleFontSize,
display: 'inline-block',
position: 'relative',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
overflow: 'hidden',
flex: 2,
},
};
}
Expand Down
2 changes: 2 additions & 0 deletions src/toolbar/toolbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ function getStyles(props, state) {
height: toolbar.height,
width: '100%',
padding: noGutter ? 0 : `0px ${baseTheme.spacing.desktopGutter}px`,
display: 'inline-flex',
justifyContent: 'space-between',
},
};
}
Expand Down

0 comments on commit 99fef2a

Please sign in to comment.