Organize components, use webpack import aliases

This commit is contained in:
Ken-Håvard Lieng 2017-06-21 08:40:28 +02:00
parent f174d98107
commit 86c5451edb
50 changed files with 269 additions and 133 deletions

View file

@ -0,0 +1,26 @@
import React, { PureComponent } from 'react';
export default class Message extends PureComponent {
handleNickClick = () => this.props.onNickClick(this.props.message.from);
render() {
const { message } = this.props;
const className = message.type ? `message message-${message.type}` : 'message';
const style = {
paddingLeft: `${window.messageIndent + 15}px`,
textIndent: `-${window.messageIndent}px`,
...this.props.style
};
return (
<p className={className} style={style}>
<span className="message-time">{message.time}</span>
{message.from &&
<span className="message-sender" onClick={this.handleNickClick}>
{' '}{message.from}
</span>
}{' '}{message.content}
</p>
);
}
}