diff --git a/demo/demo.jsx b/demo/demo.jsx index 442eff8..ab48015 100644 --- a/demo/demo.jsx +++ b/demo/demo.jsx @@ -25,22 +25,25 @@ class ChangingProgressbar extends React.Component { super(props); this.state = { - percentage: 0, + currentPercentageIndex: 0, }; } componentDidMount() { setInterval(() => { this.setState({ - percentage: (this.state.percentage + 20) % 120 + currentPercentageIndex: (this.state.currentPercentageIndex + 1) % this.props.percentages.length }); - }, 1000); + }, this.props.interval); } render() { - return ; + return ; } } +ChangingProgressbar.defaultProps = { + interval: 1000, +} class Demo extends React.Component { render() { @@ -57,8 +60,9 @@ class Demo extends React.Component {
- - +
@@ -71,12 +75,17 @@ class Demo extends React.Component {
- { - return percentage < 50 ? 'low' : 'high'; - }} - /> -

Configure it to change based on percentage. Using plain old CSS classes.

+
+
+ { + return percentage === 100 ? 'complete' : 'incomplete'; + }} + /> +
+
+

Configure color/styling based on percentage using plain old CSS classes.

diff --git a/package.json b/package.json index f42d205..af0ae14 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "react-circular-progressbar", "version": "0.1.0", - "description": "A circular progressbar svg component", + "description": "A circular progress indicator", "author": "Kevin Qi ", "main": "./build/index.js", "repository": { diff --git a/src/styles.css b/src/styles.css index 5f7f35a..1b05a4f 100644 --- a/src/styles.css +++ b/src/styles.css @@ -21,15 +21,13 @@ text-anchor: middle; } -.CircularProgressbar.low .CircularProgressbar-path { - stroke: #00f; +.CircularProgressbar.incomplete .CircularProgressbar-path { + stroke: #f66; } -.CircularProgressbar.low .CircularProgressbar-text { - fill: #00f; +.CircularProgressbar.incomplete .CircularProgressbar-text { + fill: #f66; } -.CircularProgressbar.high .CircularProgressbar-path { - stroke: #f00; +.CircularProgressbar.complete .CircularProgressbar-path { } -.CircularProgressbar.high .CircularProgressbar-text { - fill: #f00; +.CircularProgressbar.complete .CircularProgressbar-text { }