emoji-mart-lazyload/docs/index.js

80 lines
1.8 KiB
JavaScript
Raw Normal View History

2017-11-09 07:58:41 +00:00
import React from 'react'
import ReactDOM from 'react-dom'
import { Picker, Emoji } from '../src'
const CUSTOM_EMOJIS = [
2017-11-09 08:59:42 +00:00
{
name: 'Party Parrot',
short_names: ['parrot'],
keywords: ['party'],
2018-01-24 01:56:02 +00:00
imageUrl: './images/parrot.gif'
2017-11-09 08:59:42 +00:00
},
2017-11-09 07:58:41 +00:00
{
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'
2017-11-09 08:59:42 +00:00
},
2017-11-09 07:58:41 +00:00
]
class Example extends React.Component {
constructor(props) {
super(props)
this.state = {
native: true,
set: 'apple',
emoji: 'point_up',
title: 'Pick your emoji…',
2017-11-09 08:28:09 +00:00
custom: CUSTOM_EMOJIS,
2017-11-09 07:58:41 +00:00
}
}
render() {
return <div>
<div className="row">
<h1>Emoji Mart 🏬</h1>
</div>
<div className="row">
{['native', 'apple', 'google', 'twitter', 'emojione', 'messenger', 'facebook'].map((set) => {
var props = { disabled: !this.state.native && set == this.state.set }
if (set == 'native' && this.state.native) {
props.disabled = true
}
return <button
key={set}
value={set}
onClick={() => {
if (set == 'native') {
this.setState({ native: true })
} else {
this.setState({ set: set, native: false })
}
}}
{...props}>
{set}
</button>
})}
</div>
<div className="row">
<Picker
{...this.state}
2018-03-15 19:36:07 +00:00
onSelect={console.log}
2017-11-09 07:58:41 +00:00
/>
</div>
</div>
}
}
2018-11-13 15:07:26 +00:00
ReactDOM.render(<Example />, document.querySelector('#picker'))