ProgressBar.js
1.02 KB
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
import React, { Component } from 'react';
import * as SelectActionCreators from './actions/profilationSelect'
import {connect} from 'react-redux';
class ProgressBar extends Component{
render(){
var count=0
for (var i = 0; i < this.props.activationSteps.length; i++) {
if(this.props.activationSteps[i].isActive)
count=i
}
const percent=((1+count)/this.props.activationSteps.length)*100
console.log(count,this.props.activationSteps.length,percent)
return(
<div className='progressBar-container'>
<div style={{width:percent+'%'}} className='progressBar'></div>
</div>)
}
}
const mapStateToProps = state => {
return {
progressBar: state.ProfilationSelectReducer.progressBar,
activationSteps: state.ProfilationSelectReducer.activationSteps
}
};
const mapDispatchToProps = dispatch => ({
updateStoreValue: (prop,value) =>
dispatch(SelectActionCreators.changeProp(prop,value)),
});
export default connect(mapStateToProps, mapDispatchToProps)(ProgressBar);