Add `showSkinTones` prop to Picker [Ref #165]
parent
a7cd5e5d96
commit
c010035015
|
@ -42,6 +42,7 @@ import { Picker } from 'emoji-mart'
|
||||||
| **backgroundImageFn** | | ```((set, sheetSize) => …)``` | A Fn that returns that image sheet to use for emojis. Useful for avoiding a request if you have the sheet locally. |
|
| **backgroundImageFn** | | ```((set, sheetSize) => …)``` | A Fn that returns that image sheet to use for emojis. Useful for avoiding a request if you have the sheet locally. |
|
||||||
| **emojisToShowFilter** | | ```((emoji) => true)``` | A Fn to choose whether an emoji should be displayed or not |
|
| **emojisToShowFilter** | | ```((emoji) => true)``` | A Fn to choose whether an emoji should be displayed or not |
|
||||||
| **showPreview** | | `true` | Display preview section |
|
| **showPreview** | | `true` | Display preview section |
|
||||||
|
| **showSkinTones** | | `true` | Display skin tones picker |
|
||||||
| **emojiTooltip** | | `false` | Show emojis short name when hovering (title) |
|
| **emojiTooltip** | | `false` | Show emojis short name when hovering (title) |
|
||||||
| **skin** | | | Forces skin color: `1, 2, 3, 4, 5, 6` |
|
| **skin** | | | Forces skin color: `1, 2, 3, 4, 5, 6` |
|
||||||
| **defaultSkin** | | `1` | Default skin color: `1, 2, 3, 4, 5, 6` |
|
| **defaultSkin** | | `1` | Default skin color: `1, 2, 3, 4, 5, 6` |
|
||||||
|
|
|
@ -425,6 +425,7 @@ export default class Picker extends React.PureComponent {
|
||||||
backgroundImageFn,
|
backgroundImageFn,
|
||||||
emojisToShowFilter,
|
emojisToShowFilter,
|
||||||
showPreview,
|
showPreview,
|
||||||
|
showSkinTones,
|
||||||
emojiTooltip,
|
emojiTooltip,
|
||||||
include,
|
include,
|
||||||
exclude,
|
exclude,
|
||||||
|
@ -504,6 +505,7 @@ export default class Picker extends React.PureComponent {
|
||||||
ref={this.setPreviewRef}
|
ref={this.setPreviewRef}
|
||||||
title={title}
|
title={title}
|
||||||
emoji={emoji}
|
emoji={emoji}
|
||||||
|
showSkinTones={showSkinTones}
|
||||||
emojiProps={{
|
emojiProps={{
|
||||||
native: native,
|
native: native,
|
||||||
size: 38,
|
size: 38,
|
||||||
|
@ -541,6 +543,7 @@ Picker.propTypes = {
|
||||||
sheetSize: Emoji.propTypes.sheetSize,
|
sheetSize: Emoji.propTypes.sheetSize,
|
||||||
emojisToShowFilter: PropTypes.func,
|
emojisToShowFilter: PropTypes.func,
|
||||||
showPreview: PropTypes.bool,
|
showPreview: PropTypes.bool,
|
||||||
|
showSkinTones: PropTypes.bool,
|
||||||
emojiTooltip: Emoji.propTypes.tooltip,
|
emojiTooltip: Emoji.propTypes.tooltip,
|
||||||
include: PropTypes.arrayOf(PropTypes.string),
|
include: PropTypes.arrayOf(PropTypes.string),
|
||||||
exclude: PropTypes.arrayOf(PropTypes.string),
|
exclude: PropTypes.arrayOf(PropTypes.string),
|
||||||
|
@ -575,6 +578,7 @@ Picker.defaultProps = {
|
||||||
backgroundImageFn: Emoji.defaultProps.backgroundImageFn,
|
backgroundImageFn: Emoji.defaultProps.backgroundImageFn,
|
||||||
emojisToShowFilter: null,
|
emojisToShowFilter: null,
|
||||||
showPreview: true,
|
showPreview: true,
|
||||||
|
showSkinTones: true,
|
||||||
emojiTooltip: Emoji.defaultProps.tooltip,
|
emojiTooltip: Emoji.defaultProps.tooltip,
|
||||||
autoFocus: false,
|
autoFocus: false,
|
||||||
custom: [],
|
custom: [],
|
||||||
|
|
|
@ -12,7 +12,7 @@ export default class Preview extends React.PureComponent {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
var { emoji } = this.state,
|
var { emoji } = this.state,
|
||||||
{ emojiProps, skinsProps, title, emoji: idleEmoji } = this.props
|
{ emojiProps, skinsProps, showSkinTones, title, emoji: idleEmoji } = this.props
|
||||||
|
|
||||||
if (emoji) {
|
if (emoji) {
|
||||||
var emojiData = getData(emoji),
|
var emojiData = getData(emoji),
|
||||||
|
@ -67,9 +67,11 @@ export default class Preview extends React.PureComponent {
|
||||||
<span className="emoji-mart-title-label">{title}</span>
|
<span className="emoji-mart-title-label">{title}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="emoji-mart-preview-skins">
|
{showSkinTones && (
|
||||||
<Skins {...skinsProps} />
|
<div className="emoji-mart-preview-skins">
|
||||||
</div>
|
<Skins {...skinsProps} />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -77,8 +79,14 @@ export default class Preview extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
Preview.propTypes = {
|
Preview.propTypes = {
|
||||||
|
showSkinTones: PropTypes.bool,
|
||||||
title: PropTypes.string.isRequired,
|
title: PropTypes.string.isRequired,
|
||||||
emoji: PropTypes.string.isRequired,
|
emoji: PropTypes.string.isRequired,
|
||||||
emojiProps: PropTypes.object.isRequired,
|
emojiProps: PropTypes.object.isRequired,
|
||||||
skinsProps: PropTypes.object.isRequired,
|
skinsProps: PropTypes.object.isRequired,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Preview.defaultProps = {
|
||||||
|
showSkinTones: true,
|
||||||
|
onChange: () => {},
|
||||||
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ storiesOf('Picker', module)
|
||||||
defaultSkin={number('Default skin tone', 1)}
|
defaultSkin={number('Default skin tone', 1)}
|
||||||
color={color('Highlight color', '#ae65c5')}
|
color={color('Highlight color', '#ae65c5')}
|
||||||
showPreview={boolean('Show preview', true)}
|
showPreview={boolean('Show preview', true)}
|
||||||
|
showSkinTones={boolean('Show skin tones', true)}
|
||||||
custom={CUSTOM_EMOJIS}
|
custom={CUSTOM_EMOJIS}
|
||||||
/>
|
/>
|
||||||
));
|
));
|
||||||
|
|
Loading…
Reference in New Issue