parent
97b20acc7f
commit
c4604741d9
|
@ -100,7 +100,8 @@ Sheets are served from [unpkg](https://unpkg.com), a global CDN that serves file
|
||||||
import { Emoji } from 'emoji-mart'
|
import { Emoji } from 'emoji-mart'
|
||||||
|
|
||||||
<Emoji emoji={{ id: 'santa', skin: 3 }} />
|
<Emoji emoji={{ id: 'santa', skin: 3 }} />
|
||||||
<Emoji set='emojione' emoji='santa' />
|
<Emoji emoji=':santa::skin-tone-3:' />
|
||||||
|
<Emoji emoji='santa' set='emojione' />
|
||||||
```
|
```
|
||||||
|
|
||||||
| Prop | Required | Default | Description |
|
| Prop | Required | Default | Description |
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import data from '../../data'
|
import data from '../../data'
|
||||||
|
|
||||||
|
const COLONS_REGEX = /^(?:\:([^\:]+)\:)(?:\:skin-tone-(\d)\:)?$/
|
||||||
const SKINS = [
|
const SKINS = [
|
||||||
'1F3FA', '1F3FB', '1F3FC',
|
'1F3FA', '1F3FB', '1F3FC',
|
||||||
'1F3FD', '1F3FE', '1F3FF',
|
'1F3FD', '1F3FE', '1F3FF',
|
||||||
|
@ -39,6 +40,16 @@ function getData(emoji, skin, set) {
|
||||||
var emojiData = {}
|
var emojiData = {}
|
||||||
|
|
||||||
if (typeof emoji == 'string') {
|
if (typeof emoji == 'string') {
|
||||||
|
let matches = emoji.match(COLONS_REGEX)
|
||||||
|
|
||||||
|
if (matches) {
|
||||||
|
emoji = matches[1]
|
||||||
|
|
||||||
|
if (matches[2]) {
|
||||||
|
skin = parseInt(matches[2])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (data.short_names.hasOwnProperty(emoji)) {
|
if (data.short_names.hasOwnProperty(emoji)) {
|
||||||
emoji = data.short_names[emoji]
|
emoji = data.short_names[emoji]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue