Skip to content

Commit

Permalink
AppBar title: node instead of string (update)
Browse files Browse the repository at this point in the history
This allows for a more generic title, e.g. an image
  • Loading branch information
0x0ece committed Feb 24, 2015
1 parent 77247b5 commit a7029bf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/js/app-bar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var AppBar = React.createClass({
propTypes: {
onMenuIconButtonTouchTap: React.PropTypes.func,
showMenuIconButton: React.PropTypes.bool,
title : React.PropTypes.string,
title : React.PropTypes.node,
zDepth: React.PropTypes.number
},

Expand All @@ -33,7 +33,11 @@ var AppBar = React.createClass({
title, menuIconButton;

if (this.props.title) {
title = <h1 className="mui-app-bar-title">{this.props.title}</h1>;
// If the title is a string, wrap in an h1 tag.
// If not, just use it as a node.
title = toString.call(this.props.title) === '[object String]' ?
<h1 className="mui-app-bar-title">{this.props.title}</h1> :
this.props.title;
}


Expand Down

0 comments on commit a7029bf

Please sign in to comment.