Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AppBar] Add an example of a clickable title #2134

Merged
merged 1 commit into from
Nov 12, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion docs/src/app/components/pages/components/app-bar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ const IconMenu = require('menus/icon-menu');
const MenuItem = require('menus/menu-item');
const MoreVertIcon = require('svg-icons/navigation/more-vert');

const styles = {
title: {
cursor: 'pointer',
},
};

export default class AppBarPage extends React.Component {

constructor(props) {
Expand Down Expand Up @@ -136,7 +142,7 @@ export default class AppBarPage extends React.Component {
iconClassNameRight="muidocs-icon-navigation-expand-more" />
<br />
<AppBar
title="Title"
title={<span style={styles.title} onTouchTap={this._onTouchTap}>Title</span>}
iconElementLeft={<IconButton><NavigationClose /></IconButton>}
iconElementRight={<FlatButton label="Save" />} />
<br />
Expand All @@ -157,4 +163,8 @@ export default class AppBarPage extends React.Component {
);
}

_onTouchTap() {
alert('onTouchTap triggered on the title component');
}

}
2 changes: 1 addition & 1 deletion docs/src/app/components/raw-code/app-bar-code.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
iconClassNameRight="muidocs-icon-navigation-expand-more" />

<AppBar
title="Title"
title={<span>Title</span>}
iconElementLeft={<IconButton><NavigationClose /></IconButton>}
iconElementRight={<FlatButton label="Save" />} />

Expand Down
2 changes: 1 addition & 1 deletion src/app-bar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ const AppBar = React.createClass({
// 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.mainElement)}>{title}</div>;
<div onTouchTap={this._onTitleTouchTap} style={this.prepareStyles(styles.title, styles.mainElement)}>{title}</div>;
}

if (showMenuIconButton) {
Expand Down