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

25 lines
526 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-15 06:56:17 +00:00
const { user, coloredNick } = this.props;
let { style } = this.props;
if (coloredNick) {
style = {
color: stringToRGB(user.nick),
...style
};
}
2018-10-06 22:25:56 +00:00
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
}
}