CheckMember.js
1.3 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
import React,{PropTypes} from 'react';
import {Table,ButtonGroup,Button,Modal,OverlayTrigger,Input,FormControls,Grid,Row,Col} from 'react-bootstrap';
import Select from 'react-select';
import 'react-select/dist/react-select.css';
import cx from 'classnames';
import s from './CheckMember.scss';
class CheckMember extends React.Component {
constructor (props, context) {
super(props, context);
this.onChange = this.onChange.bind(this);
this.state={
checked:false
}
}
static propTypes={
onChange: PropTypes.func,
imageUrl:PropTypes.string,
name:PropTypes.string,
uuid:PropTypes.string,
item:PropTypes.object
}
onChange(){
const {item}=this.props;
const {checked} = this.state;
if(checked==false){
this.setState({checked:true});
}
else{
this.setState({checked:false});
}
this.props.onChange(item);
}
render(){
const {imageUrl, name}= this.props;
const {checked} = this.state;
const imageStyle = {'backgroundImage': 'url('+imageUrl+')'};
return(
<div className={cx(s.member_token)}>
<input type="checkbox" checked={checked} onChange={this.onChange}/>
<span className={cx(s.member_image, s.thumb_24)} style={imageStyle}>
</span>
{name}
</div>
);
}
}
export default CheckMember;