Created
April 3, 2018 18:30
-
-
Save amsheehan/3a1d900fab65a593ab12fe2ee29e2cdd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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