import React from 'react' import ReactDOM from 'react-dom' import { Picker, Emoji } from '../src' const CUSTOM_EMOJIS = [ { name: 'Octocat', short_names: ['octocat'], keywords: ['github'], imageUrl: 'https://assets-cdn.github.com/images/icons/emoji/octocat.png?v7' }, { name: 'Squirrel', short_names: ['shipit', 'squirrel'], keywords: ['github'], imageUrl: 'https://assets-cdn.github.com/images/icons/emoji/shipit.png?v7' } ] const CATEGORIES = [ 'recent', 'people', 'nature', 'foods', 'activity', 'places', 'objects', 'symbols', 'flags', 'custom', ] class Example extends React.Component { constructor(props) { super(props) this.state = { emojiSize: 24, perLine: 9, skin: 1, native: true, set: 'apple', hidden: false, currentEmoji: 'thumbsup', autoFocus: false, include: [], exclude: [], } } handleInput(e) { var { currentTarget } = e, { type } = currentTarget, key = currentTarget.getAttribute('data-key'), mount = currentTarget.getAttribute('data-mount'), state = {} if (type == 'checkbox') { var { checked } = currentTarget, value = currentTarget.getAttribute('data-value') if (value) { if (checked) { state[key] = this.state[key].concat(value) } else { state[key] = this.state[key].filter((item) => { return item != value }) } } else { state[key] = checked } } else { var { value } = currentTarget state[key] = parseInt(value) } if (mount) { this.setState({ hidden: true }, () => { state.hidden = false this.setState(state) }) } else { this.setState(state) } } render() { return
{!this.state.hidden &&import {Picker}from 'emoji-mart'
< Picker
emojiSize= {{this.state.emojiSize} }
perLine= {{this.state.perLine} } {this.state.perLine < 10 ? ' ' : ' '}
skin= {{this.state.skin} }
set= '{this.state.set}'
custom= {{'[…]'} }
autoFocus= {{this.state.autoFocus ? 'true' : 'false'} }{this.state.autoFocus ? ' ' : ''}include= [ {[0, 2, 4, 6, 8].map((i) => { let category1 = CATEGORIES[i], category2 = CATEGORIES[i + 1] return{category2 && }})} ]exclude= [ {[0, 2, 4, 6, 8].map((i) => { let category1 = CATEGORIES[i], category2 = CATEGORIES[i + 1] return{category2 && }})} ]/>
{Emoji({ emoji: this.state.currentEmoji, size: 64, set: this.state.set, })}import {Emoji}from 'emoji-mart'
< Emoji
emoji= 'thumbsup'
size= {{64} }/>
{Emoji({ emoji: `:${this.state.currentEmoji}:`, size: 64, set: this.state.set, })}< Emoji
emoji= ':thumbsup:'
size= {{64} }/>
{Emoji({ emoji: `:${this.state.currentEmoji}::skin-tone-3:`, size: 64, set: this.state.set, })}< Emoji
emoji= ':thumbsup::skin-tone-3:'
size= {{64} }/>
{Emoji({ emoji: `:${this.state.currentEmoji}::skin-tone-3:`, size: 64, native: true, })}< Emoji
emoji= ':thumbsup::skin-tone-3:'
size= {{64} }
native= {{'true'} }/>