add emoji picker unstyled
This commit is contained in:
parent
8e50efb3c1
commit
eb0a7b20aa
3 changed files with 54 additions and 8 deletions
42
frontend/src/components/MapChat/NewMessage.js
Normal file
42
frontend/src/components/MapChat/NewMessage.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
import React, { PropTypes, Component } from 'react'
|
||||
import { Picker } from 'emoji-mart'
|
||||
|
||||
class NewMessage extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
|
||||
this.state = {
|
||||
//showEmojiPicker: false
|
||||
showEmojiPicker: true
|
||||
}
|
||||
}
|
||||
|
||||
toggleEmojiPicker = () => {
|
||||
this.setState({ showEmojiPicker: !this.state.showEmojiPicker })
|
||||
}
|
||||
|
||||
render = () => {
|
||||
return (
|
||||
<div className="new-message-area">
|
||||
<span onClick={this.toggleEmojiPicker}>Emoji</span>
|
||||
<Picker set='emojione' style={{ display: this.state.showEmojiPicker ? 'block' : 'none' }} />
|
||||
<textarea {...this.props.textAreaProps} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
NewMessage.propTypes = {
|
||||
textAreaProps: PropTypes.shape({
|
||||
className: PropTypes.string,
|
||||
ref: PropTypes.func,
|
||||
placeholder: PropTypes.string,
|
||||
value: PropTypes.string,
|
||||
onChange: PropTypes.func,
|
||||
onKeyUp: PropTypes.func,
|
||||
onFocus: PropTypes.func,
|
||||
onBlur: PropTypes.func
|
||||
})
|
||||
}
|
||||
|
||||
export default NewMessage
|
|
@ -2,6 +2,7 @@ import React, { PropTypes, Component } from 'react'
|
|||
import Unread from './Unread'
|
||||
import Participant from './Participant'
|
||||
import Message from './Message'
|
||||
import NewMessage from './NewMessage'
|
||||
|
||||
function makeList(messages) {
|
||||
let currentHeader
|
||||
|
@ -143,14 +144,16 @@ class MapChat extends Component {
|
|||
<div className="chat-messages" ref={div => this.messagesDiv = div}>
|
||||
{makeList(messages)}
|
||||
</div>
|
||||
<textarea className="chat-input"
|
||||
ref={textarea => this.messageInput = textarea}
|
||||
placeholder="Send a message..."
|
||||
value={this.state.messageText}
|
||||
onChange={this.handleChange('messageText')}
|
||||
onKeyUp={this.handleTextareaKeyUp}
|
||||
onFocus={this.props.inputFocus}
|
||||
onBlur={this.props.inputBlur}
|
||||
<NewMessage textAreaProps={{
|
||||
className: 'chat-input',
|
||||
ref: textarea => this.messageInput = textarea,
|
||||
placeholder: 'Send a message...',
|
||||
value: this.state.messageText,
|
||||
onChange: this.handleChange('messageText'),
|
||||
onKeyUp: this.handleTextareaKeyUp,
|
||||
onFocus: this.props.inputFocus,
|
||||
onBlur: this.props.inputBlur
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
"clipboard-js": "0.3.2",
|
||||
"commonmark": "0.27.0",
|
||||
"csv-parse": "1.1.7",
|
||||
"emoji-mart": "^0.3.5",
|
||||
"getScreenMedia": "git://github.com/devvmh/getScreenMedia#patch-1",
|
||||
"hark": "git://github.com/devvmh/hark#patch-1",
|
||||
"howler": "2.0.2",
|
||||
|
|
Loading…
Add table
Reference in a new issue