@@ -11,8 +11,12 @@ var AppBar = React.createClass({
1111 propTypes : {
1212 onMenuIconButtonTouchTap : React . PropTypes . func ,
1313 showMenuIconButton : React . PropTypes . bool ,
14+ iconClassNameLeft : React . PropTypes . string ,
15+ iconElementLeft : React . PropTypes . element ,
16+ iconElementRight : React . PropTypes . element ,
1417 title : React . PropTypes . node ,
15- zDepth : React . PropTypes . number
18+ zDepth : React . PropTypes . number ,
19+
1620 } ,
1721
1822 getDefaultProps : function ( ) {
@@ -23,14 +27,20 @@ var AppBar = React.createClass({
2327 }
2428 } ,
2529
30+ componentDidMount : function ( ) {
31+ var warning = 'Properties iconClassNameLeft and iconElementLeft cannot be simultaneously ' +
32+ 'defined. Please use one or the other.' ;
33+ if ( this . props . iconElementLeft && this . props . iconClassNameLeft ) console . warn ( warning ) ;
34+ } ,
35+
2636 render : function ( ) {
2737 var {
2838 onTouchTap,
2939 ...other
3040 } = this . props ;
3141
3242 var classes = this . getClasses ( 'mui-app-bar' ) ,
33- title , menuIconButton ;
43+ title , menuElementLeft , menuElementRight ;
3444
3545 if ( this . props . title ) {
3646 // If the title is a string, wrap in an h1 tag.
@@ -40,24 +50,34 @@ var AppBar = React.createClass({
4050 this . props . title ;
4151 }
4252
43-
44-
45-
4653 if ( this . props . showMenuIconButton ) {
47- menuIconButton = (
48- < IconButton
49- className = "mui-app-bar-navigation-icon-button"
50- onTouchTap = { this . _onMenuIconButtonTouchTap } >
51- < NavigationMenu />
52- </ IconButton >
53- ) ;
54+ if ( this . props . iconElementLeft ) {
55+ menuElementLeft = (
56+ < div className = "mui-app-bar-navigation-icon-button" >
57+ { this . props . iconElementLeft }
58+ </ div >
59+ ) ;
60+ } else {
61+ var child = ( this . props . iconClassNameLeft ) ? '' : < NavigationMenu /> ;
62+ menuElementLeft = (
63+ < IconButton
64+ className = "mui-app-bar-navigation-icon-button"
65+ iconClassName = { this . props . iconClassNameLeft }
66+ onTouchTap = { this . _onMenuIconButtonTouchTap } >
67+ { child }
68+ </ IconButton >
69+ ) ;
70+ }
5471 }
5572
73+ menuElementRight = ( this . props . children ) ? this . props . children :
74+ ( this . props . iconElementRight ) ? this . props . iconElementRight : '' ;
75+
5676 return (
5777 < Paper rounded = { false } className = { classes } zDepth = { this . props . zDepth } >
58- { menuIconButton }
78+ { menuElementLeft }
5979 { title }
60- { this . props . children }
80+ { menuElementRight }
6181 </ Paper >
6282 ) ;
6383 } ,
0 commit comments