-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.jsx
56 lines (54 loc) · 1.87 KB
/
demo.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import React from 'react'
import SteppedProgressBar from './index'
class SPB extends React.Component {
constructor(props) {
super(props)
this.state = {
current: 0
}
}
render() {
const n = this.props.num || this.props.labels.length
const onNext = e => {
this.state.current++
if (this.state.current >= n)
this.state.current = 0
this.setState({ current: this.state.current })
}
const onGotoStep = step => {
if (step < this.state.current)
this.setState({ current: step })
}
return <div>
<SteppedProgressBar current={this.state.current} onClick={onGotoStep} {...this.props} /><br/>
<button onClick={onNext}>Move Forward</button>
</div>
}
}
export default class SteppedProgressBarView extends React.Component {
render() {
return <div>
<h1>patchkit-stepped-progress-bar</h1>
<section className="stepped-progress-bar-num3">
<header><SteppedProgressBar num="3"></header>
<div className="content"><SPB num={3}/></div>
</section>
<section className="stepped-progress-bar-num3-cangoback">
<header><SteppedProgressBar num="3" canGoBack></header>
<div className="content"><SPB num={3} canGoBack /></div>
</section>
<section className="stepped-progress-bar-num4">
<header><SteppedProgressBar num="4"></header>
<div className="content"><SPB num={4} /></div>
</section>
<section className="stepped-progress-bar-num5">
<header><SteppedProgressBar num="5"></header>
<div className="content"><SPB num={5} /></div>
</section>
<section className="stepped-progress-bar-labels">
<header><SteppedProgressBar labels="..."></header>
<div className="content"><SPB labels={['first', 'second', 'third', 'fourth']} /></div>
</section>
</div>
}
}