Skip to content

Instantly share code, notes, and snippets.

@amsheehan
Created April 3, 2018 18:30
Show Gist options
  • Save amsheehan/3a1d900fab65a593ab12fe2ee29e2cdd to your computer and use it in GitHub Desktop.
Save amsheehan/3a1d900fab65a593ab12fe2ee29e2cdd to your computer and use it in GitHub Desktop.
import React, {Component} from 'react';
class TopAppBar extends Component {
render() {
return (
<div className="mdc-top-app-bar">
{this.props.children}
</div>
);
}
}
class MyCoolApp extends Component {
constructor(props) {
super(props);
this.state = {
navIconChangedOrWhatever: false,
}
this.handleIconClick = this.handleIconClick.bind(this);
}
handleIconClick() {
this.setState({navIconChangedOrWhatever: true});
}
render() {
const classes = `mdc-icon whatever ${this.state.navIconChangedOrWhatever ? 'mdc-icon--modified' : ''}`;
return (
<TopAppBar>
<div className={classes}
onClick={this.handleIconClick}>some icon</div>
<div className="some other stuff">
</TopAppBar>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment