Skip to content

Instantly share code, notes, and snippets.

@scott-riley
Last active February 13, 2016 22:13
Show Gist options
  • Save scott-riley/1952b73aae616b3b7671 to your computer and use it in GitHub Desktop.
Save scott-riley/1952b73aae616b3b7671 to your computer and use it in GitHub Desktop.
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