Add colored nicks

This commit is contained in:
Ken-Håvard Lieng 2018-10-07 00:25:56 +02:00
parent 937987da82
commit b3f2b53a6f
6 changed files with 46 additions and 6 deletions

View file

@ -1,12 +1,19 @@
import React, { PureComponent } from 'react';
import stringToHSL from 'utils/color';
export default class UserListItem extends PureComponent {
handleClick = () => this.props.onClick(this.props.user.nick);
render() {
const { user } = this.props;
const style = {
color: stringToHSL(user.nick),
...this.props.style
};
return (
<p style={this.props.style} onClick={this.handleClick}>
{this.props.user.renderName}
<p style={style} onClick={this.handleClick}>
{user.renderName}
</p>
);
}