StickyFooter.js
1.88 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import React, { Component } from 'react';
import {NavLink} from 'react-router-dom';
import PropTypes from 'prop-types'
import * as SelectActionCreators from '../../actions/profilationSelect'
import { connect } from 'react-redux';
class StickyFooter extends Component {
constructor(props){
super(props)
this.selectSolution=this.selectSolution.bind(this)
}
selectSolution(index){
this.props.changeSolution(index,'isSelected','true')
}
render(){
const footerCards=this.props.solutions.map((solution,index) => (
<li key={index} className={solution.isActive? "isActive" :""}>
<div>
<p className="offers"><strong>{solution.name}</strong></p>
<p className="price"><span>€</span><strong>{solution.price}</strong>/ mese + IVA</p>
<NavLink to={`/activation`} activeClassName="active">
<button className="btn btn__gray" onClick={() => this.selectSolution(index)}>Attiva Ora</button>
</NavLink>
</div>
</li>
))
return(
<div className="bigContainer stickySelect__button stickyNav isSticky">
<ul>
{footerCards}
</ul>
</div>
)
}
}
const mapStateToProps = state => {
return {
steps:state.ProfilationSelectReducer.steps,
solutions:state.ProfilationSelectReducer.solutions
}};
const mapDispatchToProps = dispatch => ({
updatePropValue: (prop,value,index,complete) =>
dispatch(SelectActionCreators.changeValue(prop,value,index,complete)),
changeSolution: (index,prop,value) =>
dispatch(SelectActionCreators.changeSolution(index,prop,value)),
});
StickyFooter.propTypes = {
solutions: PropTypes.array.isRequired,
steps: PropTypes.array.isRequired,
updatePropValue: PropTypes.func.isRequired,
}
export default connect(mapStateToProps, mapDispatchToProps)(StickyFooter);