diff --git a/README.md b/README.md index 55e00d7..d1b3900 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ import { Picker } from 'emoji-mart' | **emojiTooltip** | | `false` | Show emojis short name when hovering (title) | | **skin** | | | Forces skin color: `1, 2, 3, 4, 5, 6` | | **defaultSkin** | | `1` | Default skin color: `1, 2, 3, 4, 5, 6` | +| **skinEmoji** | | | The emoji used to pick a skin tone. Uses an emoji-less skin tone picker by default | | **style** | | | Inline styles applied to the root element. Useful for positioning | | **title** | | `Emoji Mart™` | The title shown when no emojis are hovered | | **notFoundEmoji** | | `sleuth_or_spy` | The emoji shown when there are no search results | @@ -58,6 +59,7 @@ import { Picker } from 'emoji-mart' ```js search: 'Search', notfound: 'No Emoji Found', +skintext: 'Choose your default skin tone', categories: { search: 'Search Results', recent: 'Frequently Used', diff --git a/css/emoji-mart.css b/css/emoji-mart.css index 8db71f1..8456e23 100644 --- a/css/emoji-mart.css +++ b/css/emoji-mart.css @@ -205,6 +205,11 @@ text-align: right; } +.emoji-mart-preview-skins.custom { + right: 10px; + text-align: right; +} + .emoji-mart-preview-name { font-size: 14px; } @@ -247,12 +252,18 @@ background-color: #fff; } -.emoji-mart-skin-swatches-opened .emoji-mart-skin-swatch { +.emoji-mart-skin-swatches.custom { + font-size: 0; + border: none; + background-color: #fff; +} + +.emoji-mart-skin-swatches.opened .emoji-mart-skin-swatch { width: 16px; padding: 0 2px; } -.emoji-mart-skin-swatches-opened .emoji-mart-skin-swatch-selected:after { +.emoji-mart-skin-swatches.opened .emoji-mart-skin-swatch.selected:after { opacity: .75; } @@ -272,12 +283,13 @@ .emoji-mart-skin-swatch:nth-child(5) { transition-delay: .12s } .emoji-mart-skin-swatch:nth-child(6) { transition-delay: .15s } -.emoji-mart-skin-swatch-selected { +.emoji-mart-skin-swatch.selected { position: relative; width: 16px; padding: 0 2px; } -.emoji-mart-skin-swatch-selected:after { + +.emoji-mart-skin-swatch.selected:after { content: ""; position: absolute; top: 50%; left: 50%; @@ -290,9 +302,63 @@ transition: opacity .2s ease-out; } +.emoji-mart-skin-swatch.custom { + display: inline-block; + width: 0; + height: 38px; + overflow: hidden; + vertical-align: middle; + transition-property: width, height; + transition-duration: .125s; + transition-timing-function: ease-out; + cursor: default; +} + +.emoji-mart-skin-swatch.custom.selected { + position: relative; + width: 36px; + height: 38px; + padding: 0 2px 0 0; +} + +.emoji-mart-skin-swatch.custom.selected:after { + content: ""; + width: 0; + height: 0; +} + +.emoji-mart-skin-swatches.custom .emoji-mart-skin-swatch.custom:hover { + background-color: #f4f4f4; + border-radius: 10%; +} + +.emoji-mart-skin-swatches.custom.opened .emoji-mart-skin-swatch.custom { + width: 36px; + height: 38px; + padding: 0 2px 0 0; +} + +.emoji-mart-skin-swatches.custom.opened .emoji-mart-skin-swatch.custom.selected:after { + opacity: .75; +} + +.emoji-mart-skin-text.opened { + display: inline-block; + vertical-align: middle; + text-align: left; + color: #888; + font-size: 11px; + padding: 5px 2px; + width: 95px; + height: 40px; + border-radius: 10%; + background-color: #fff; +} + .emoji-mart-skin { display: inline-block; - width: 100%; padding-top: 100%; + width: 100%; + padding-top: 100%; max-width: 12px; border-radius: 100%; } diff --git a/src/components/index.js b/src/components/index.js index 81faff2..9c4c019 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -4,6 +4,8 @@ export { default as Preview } from './preview' export { default as NotFound } from './not-found' export { default as Search } from './search' export { default as Skins } from './skins' +export { default as SkinsEmoji } from './skins-emoji' +export { default as SkinsDot } from './skins-dot' export { default as Emoji } from './emoji/emoji' export { default as NimbleEmoji } from './emoji/nimble-emoji' diff --git a/src/components/picker/nimble-picker.js b/src/components/picker/nimble-picker.js index 762c950..d7d85cf 100644 --- a/src/components/picker/nimble-picker.js +++ b/src/components/picker/nimble-picker.js @@ -15,6 +15,7 @@ import { Anchors, Category, Preview, Search } from '..' const I18N = { search: 'Search', notfound: 'No Emoji Found', + skintext: 'Choose your default skin tone', categories: { search: 'Search Results', recent: 'Frequently Used', @@ -471,6 +472,7 @@ export default class NimblePicker extends React.PureComponent { exclude, recent, autoFocus, + skinEmoji, notFound, notFoundEmoji, } = this.props, @@ -574,7 +576,9 @@ export default class NimblePicker extends React.PureComponent { skinsProps={{ skin: skin, onChange: this.handleSkinChange, + skinEmoji: skinEmoji, }} + i18n={this.i18n} /> )} diff --git a/src/components/preview.js b/src/components/preview.js index a484055..c6f7b20 100644 --- a/src/components/preview.js +++ b/src/components/preview.js @@ -2,7 +2,7 @@ import React from 'react' import PropTypes from 'prop-types' import { getData } from '../utils' -import { NimbleEmoji, Skins } from '.' +import { NimbleEmoji, SkinsEmoji, SkinsDot } from '.' export default class Preview extends React.PureComponent { constructor(props) { @@ -20,6 +20,7 @@ export default class Preview extends React.PureComponent { showSkinTones, title, emoji: idleEmoji, + i18n, } = this.props if (emoji) { @@ -81,8 +82,27 @@ export default class Preview extends React.PureComponent { {showSkinTones && ( -