dispatch/client/src/js/components/pages/Chat/UserListItem.js

21 lines
460 B
JavaScript
Raw Normal View History

import React, { PureComponent } from 'react';
2018-10-07 23:34:53 +00:00
import stringToRGB from 'utils/color';
2015-12-28 23:34:32 +00:00
export default class UserListItem extends PureComponent {
handleClick = () => this.props.onClick(this.props.user.nick);
2015-12-28 23:34:32 +00:00
render() {
2018-10-06 23:27:26 +00:00
const { user } = this.props;
2018-10-06 22:25:56 +00:00
const style = {
2018-10-07 23:34:53 +00:00
color: stringToRGB(user.nick),
2018-10-06 22:25:56 +00:00
...this.props.style
};
2017-03-23 19:38:27 +00:00
return (
2018-10-06 22:25:56 +00:00
<p style={style} onClick={this.handleClick}>
{user.renderName}
2017-03-23 19:38:27 +00:00
</p>
);
2015-12-28 23:34:32 +00:00
}
}