Code split the client, update dependencies

This commit is contained in:
Ken-Håvard Lieng 2018-11-04 07:22:46 +01:00
parent 84c3d5cc88
commit d930365eeb
37 changed files with 2036 additions and 1181 deletions

View file

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