SolutionSingleSlide.js
2.79 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import React, { Component } from 'react';
import {NavLink} from 'react-router-dom';
import * as SelectActionCreators from '../../actions/profilationSelect'
import { connect } from 'react-redux';
class SolutionSingleSlide extends Component {
constructor(props){
super(props)
this.openModal=this.openModal.bind(this)
this.selectSolution=this.selectSolution.bind(this)
}
selectSolution(){
this.props.updateStoreValue('showSessionMessage',false)
this.props.updateStoreValue('progressBar',6)
this.props.changeSolution(this.props.index,'isSelected','true')
}
openModal(index,modal){
this.props.updateStoreValue('solutionInModal',index)
this.props.showModal(modal)
}
render(){
return(
<div>
{this.props.solution.isActive && <h6>Consigliata per te</h6> }
<div className="sliderItemTop">
<figure>
<img src={this.props.solution.icon} alt={this.props.solution.name} />
</figure>
<h2>{this.props.solution.name}</h2>
</div>
<div className="sliderItemContent">
<p className="description lighter">{this.props.solution.description}</p>
<p>{this.props.solution.service}</p>
<p className="price">
<span className="fiat">€</span> <strong>{this.props.solution.price}</strong> <span className="month">/ mese + IVA</span>
</p>
<p>Spesa fissa totale</p>
</div>
<div className="sliderItemAction">
<NavLink to={`/activation`} activeClassName="active">
<button className="btn btn__gray" onClick={() => this.selectSolution()}>Attiva Ora</button>
</NavLink>
<a id="show-modal-two" data-modal="view-details" className="triggher_modal underline" onClick={() => this.openModal(this.props.index,'DETAILS_MODAL')}>Vedi dettagli</a>
</div>
</div>
)
}
}
const mapStateToProps = state => {
return {
steps:state.ProfilationSelectReducer.steps,
solutions:state.ProfilationSelectReducer.solutions,
modalOpen:state.ProfilationSelectReducer.modalOpen
}};
const mapDispatchToProps = dispatch => ({
updatePropValue: (prop,value,index,complete) =>
dispatch(SelectActionCreators.changeValue(prop,value,index,complete)),
updateStoreValue: (prop,value) =>
dispatch(SelectActionCreators.changeProp(prop,value)),
hideModal: () =>
dispatch(SelectActionCreators.hideModal()),
showModal: (modalName) =>
dispatch(SelectActionCreators.showModal(modalName)),
changeSolution: (index,prop,value) =>
dispatch(SelectActionCreators.changeSolution(index,prop,value)),
});
export default connect(mapStateToProps, mapDispatchToProps)(SolutionSingleSlide);