ProgressBar.js 1.02 KB
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);