diff --git a/app/components/ChatRoom.js b/app/components/ChatRoom.js index e15d5d5..6bde48a 100644 --- a/app/components/ChatRoom.js +++ b/app/components/ChatRoom.js @@ -15,6 +15,7 @@ import Dropzone from 'react-dropzone'; import Jazzicon, { jsNumberForAddress } from 'react-jazzicon'; import { Picker } from 'emoji-mart'; import InsertEmoticon from '@material-ui/icons/InsertEmoticon' +import AddCircle from '@material-ui/icons/AddCircle' import ChatBox, { Emoji } from './ChatBox'; import ChatHeader from './ChatHeader'; @@ -86,10 +87,15 @@ class ChatRoom extends Component { this.setState(({showEmojis: !this.state.showEmojis})); } + uploadFileDialog() { + } + addEmoji(emoji, chatInput, setValue) { console.log(emoji); setValue('chatInput', `${chatInput}:${emoji.id}:`); - this.setState(({showEmojis: false})); + this.setState(({showEmojis: false}), () => { + this.nameInput.labelNode.focus(); + }); // } @@ -164,8 +170,11 @@ class ChatRoom extends Component {
+ { this.nameInput = input; }} multiline style={{ width: 'auto', flexGrow: '0.95', margin: '2px 0 0 0' }} label="Type a message..." @@ -178,7 +187,8 @@ class ChatRoom extends Component { onKeyDown={(e) => keyDownHandler(e, typingEvent, setFieldValue, values.chatInput)} onBlur={handleBlur} value={values.chatInput || ''} - /> + > + {showEmojis && this.addEmoji(emoji, values.chatInput, setFieldValue)} style={{ position: 'absolute', bottom: '80px', right: '20px' }}/>}