2016-04-29 03:02:51 +08:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import { Link } from 'react-router';
|
2016-06-02 00:33:19 +08:00
|
|
|
import styles from './styles';
|
|
|
|
|
|
|
|
import MessageForm from './message-form/component';
|
|
|
|
import MessageList from './message-list/component';
|
|
|
|
import Icon from '../icon/component';
|
|
|
|
|
|
|
|
const ELEMENT_ID = 'chat-messages';
|
2016-04-29 03:02:51 +08:00
|
|
|
|
|
|
|
export default class Chat extends Component {
|
2016-06-02 00:33:19 +08:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
}
|
|
|
|
|
2016-04-29 03:02:51 +08:00
|
|
|
render() {
|
2016-06-02 00:33:19 +08:00
|
|
|
const {
|
|
|
|
title,
|
|
|
|
messages,
|
2016-06-03 02:40:27 +08:00
|
|
|
actions,
|
2016-06-02 00:33:19 +08:00
|
|
|
} = this.props;
|
|
|
|
|
2016-04-29 03:02:51 +08:00
|
|
|
return (
|
2016-06-02 00:33:19 +08:00
|
|
|
<section className={styles.chat}>
|
|
|
|
<header className={styles.header}>
|
|
|
|
<Link className={styles.closeChat} to="/users">
|
|
|
|
<Icon iconName="left-arrow" /> {title}
|
|
|
|
</Link>
|
|
|
|
</header>
|
|
|
|
<MessageList
|
|
|
|
messages={messages}
|
|
|
|
id={ELEMENT_ID}
|
|
|
|
tabindex="0"
|
|
|
|
role="log"
|
|
|
|
aria-atomic="true"
|
|
|
|
aria-relevant="additions"
|
|
|
|
/>
|
2016-06-03 02:40:27 +08:00
|
|
|
<MessageForm
|
|
|
|
chatAreaId={ELEMENT_ID}
|
|
|
|
chatTitle={title}
|
|
|
|
handleSendMessage={actions.handleSendMessage}
|
|
|
|
/>
|
2016-06-02 00:33:19 +08:00
|
|
|
</section>
|
2016-04-29 03:02:51 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|