CheckBox.js
1.76 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 * as SelectActionCreators from '../../actions/profilationSelect'
import {connect} from 'react-redux';
/*
API
<CheckBox value={} name={} onChange={}>
Testo label
</CheckBox>
*/
class CheckBox extends Component{
render(){
var className=''
if(typeof this.props.className!== 'undefined'){
className=this.props.className
}
return(
<div className={"choice-ct checkbox-component "+className}>
<p>
<input type="checkbox" id={this.props.name} name={this.props.name} className="samefile"
onChange={this.props.onChange}
value={this.props.value}
checked={!!this.props.value} />
<label className="flex" htmlFor={this.props.name}><span className="isCheckbox"></span>
<span className="flex-test">
{this.props.children}
</span>
</label>
</p>
</div>
)
}
}
const mapStateToProps = state => {
return {
activationSteps: state.ProfilationSelectReducer.activationSteps,
valuesAccepted: state.ProfilationSelectReducer.valuesAccepted,
activationAdAccepted:state.ProfilationSelectReducer.activationAdAccepted,
commercialAccepted:state.ProfilationSelectReducer.commercialAccepted,
}
};
const mapDispatchToProps = dispatch => ({
updateStoreValue: (prop,value) =>
dispatch(SelectActionCreators.changeProp(prop,value)),
updateActivation: (index,prop,value) => dispatch(SelectActionCreators.updateActivation(index,prop,value)),
showModal: (modalName) =>
dispatch(SelectActionCreators.showModal(modalName)),
});
export default connect(mapStateToProps, mapDispatchToProps)(CheckBox);