Add colored nicks
This commit is contained in:
parent
937987da82
commit
b3f2b53a6f
6 changed files with 46 additions and 6 deletions
|
@ -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>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue