docbrown/app/javascript/chat/compose.jsx
Mac Siri 2c456dcf86 Update Chat (#342)
* Remove the need for hiddenMessage class

* Prevent compose component from being re-rendered

* Add IntersectionObserver polyfill
2018-05-23 09:10:00 -04:00

34 lines
780 B
JavaScript

import { h, Component } from 'preact';
import PropTypes from 'prop-types';
export default class Chat extends Component {
static propTypes = {
handleKeyDown: PropTypes.func.isRequired,
handleSubmitOnClick: PropTypes.func.isRequired,
};
shouldComponentUpdate() {
return false;
}
render() {
const { handleSubmitOnClick, handleKeyDown } = this.props;
return (
<div className="messagecomposer">
<textarea
className="messagecomposer__input"
id="messageform"
placeholder="Message goes here"
onKeyDown={handleKeyDown}
/>
<button
className="messagecomposer__submit"
onClick={handleSubmitOnClick}
>
SEND
</button>
</div>
);
}
}