Skip to content

Commit

Permalink
Merge pull request #2324 from rolandpoulter/custom-title-styles
Browse files Browse the repository at this point in the history
[AppBar] Adds titleStyle prop
  • Loading branch information
oliviertassinari committed Dec 1, 2015
2 parents e47c759 + a0453e1 commit f80584d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions docs/src/app/components/pages/components/app-bar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ export default class AppBarPage extends React.Component {
desc: 'Determines whether or not to display the Menu icon next to ' +
'the title. Setting this prop to false will hide the icon.',
},
{
name: 'titleStyle',
type: 'object',
header: 'optional',
desc: 'Override the inline-styles of the app bar\'s title element.',
},
{
name: 'title',
type: 'node',
Expand Down
6 changes: 4 additions & 2 deletions src/app-bar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const AppBar = React.createClass({
iconElementLeft: React.PropTypes.element,
iconElementRight: React.PropTypes.element,
iconStyleRight: React.PropTypes.object,
titleStyle: React.PropTypes.object,
title: React.PropTypes.node,
zDepth: PropTypes.zDepth,
},
Expand Down Expand Up @@ -137,6 +138,7 @@ const AppBar = React.createClass({
render() {
let {
title,
titleStyle,
iconStyleRight,
showMenuIconButton,
iconElementLeft,
Expand All @@ -163,8 +165,8 @@ const AppBar = React.createClass({
// If the title is a string, wrap in an h1 tag.
// If not, just use it as a node.
titleElement = typeof title === 'string' || title instanceof String ?
<h1 onTouchTap={this._onTitleTouchTap} style={this.prepareStyles(styles.title, styles.mainElement)}>{title}</h1> :
<div onTouchTap={this._onTitleTouchTap} style={this.prepareStyles(styles.title, styles.mainElement)}>{title}</div>;
<h1 onTouchTap={this._onTitleTouchTap} style={this.prepareStyles(styles.title, styles.mainElement, titleStyle)}>{title}</h1> :
<div onTouchTap={this._onTitleTouchTap} style={this.prepareStyles(styles.title, styles.mainElement, titleStyle)}>{title}</div>;
}

if (showMenuIconButton) {
Expand Down

0 comments on commit f80584d

Please sign in to comment.