Member.js
1.6 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
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 {Gravatar} from './ChatWidget';
import 'react-select/dist/react-select.css';
import cx from 'classnames';
import s from './Member.scss';
class Member extends React.Component {
constructor (props, context) {
super(props, context);
this.onClick = this.onClick.bind(this);
this.onChange = this.onChange.bind(this);
}
static propTypes={
onClick: PropTypes.func,
onChange: PropTypes.func,
imageUrl:PropTypes.string,
name:PropTypes.string,
myself:PropTypes.bool,
checked:PropTypes.bool,
uuid:PropTypes.string,
choiceType:PropTypes.string,
item:PropTypes.object
}
onClick(){
const {uuid, item}=this.props;
this.props.onClick(uuid, item);
}
onChange(){
const {uuid, item}=this.props;
this.props.onChange(uuid, item);
}
render(){
const {name,choiceType, checked,myself,imageUrl}=this.props;console.log(imageUrl);
return(
<div className={cx(s.member_token)} onClick={this.onClick}>
{choiceType=='multi'&&<input type="checkbox" checked={checked} onChange={this.onChange}/>}
<Gravatar path={imageUrl||'./img/user.jpg'} size='60'></Gravatar>
<div className={cx(s.member_info)}>
<div className={cx(s.member_info_item)}>{name}</div>
</div>
<div className={cx(s.member_state)}>
<i className={cx('ts_icon','ts_icon_presence_online',myself?s.myself:s.other)} title="online" ></i>
</div>
</div>
);
}
}
export default Member;