MCPcopy Create free account
hub / github.com/flyfloor/react-component / ProgressDemo

Class ProgressDemo

demo/example/ProgressDemo.jsx:4–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2import {Progress} from './index';
3
4export default class ProgressDemo extends Component {
5 constructor(props){
6 super(props);
7 this.state = {
8 value: 30,
9 };
10 }
11
12 handleMinus(){
13 let {value} = this.state;
14 value -= 10;
15 if (value < 0) value = 0;
16 this.setState({
17 value,
18 });
19 }
20
21 handlePlus(){
22 let {value} = this.state;
23 value += 10;
24 if (value > 100) value = 100;
25 this.setState({
26 value
27 });
28 }
29
30 render() {
31 const {value} = this.state;
32 return (
33 <div>
34 <h3>Progress</h3>
35 <ol style={{'width': '80%'}}>
36 <li>
37 <h4>Default progress</h4>
38 <Progress value={value}/>
39 <h2>
40 <a href="javascript:;" onClick={this.handleMinus.bind(this)}>-</a>
41 <span> </span>
42 <a href="javascript:;" onClick={this.handlePlus.bind(this)}>+</a>
43 </h2>
44 <pre>
45 <code>
46 {`<Progress value={value}/>`}
47 </code>
48 </pre>
49 </li>
50 <li>
51 <h4>Animated progress</h4>
52 <Progress value={40} status="active"/>
53 <pre>
54 <code>
55 {`<Progress value={40} status="active"/>`}
56 </code>
57 </pre>
58 </li>
59 <li>
60 <h4>Completed progress</h4>
61 <Progress value={100}/>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…