Last active
February 13, 2016 22:13
-
-
Save scott-riley/1952b73aae616b3b7671 to your computer and use it in GitHub Desktop.
This file contains hidden or 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, PropTypes } from 'react'; | |
import withStyles from 'isomorphic-style-loader/lib/withStyles'; | |
import s from './ProgressContainer.scss'; | |
class ProgressContainer extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
completionPercent: 0, | |
} | |
this.updateCompletion.bind(this); | |
} | |
updateCompletion(increment = 5) { | |
let currentCompletion = this.state.completionPercent; | |
let newCompletion = currentCompletion + increment; | |
this.setState({completionPercent : newCompletion}) ; | |
} | |
render() { | |
const {completionPercent} = this.state; | |
return ( | |
<div className={s.root}> | |
<ProgressBar completed={completionPercent} /> | |
<a onClick={this.updateCompletion(5)}>Add 5% now!</a> | |
</div> | |
); | |
} | |
} | |
export default withStyles(ProgressContainer, s); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment