💄 Prettier
parent
892096ea27
commit
8660a146e2
|
@ -186,7 +186,9 @@ export default class NimbleCategory extends React.Component {
|
|||
</div>
|
||||
|
||||
{emojis &&
|
||||
emojis.map((emoji) => NimbleEmoji({ emoji: emoji, data: this.data, ...emojiProps }))}
|
||||
emojis.map((emoji) =>
|
||||
NimbleEmoji({ emoji: emoji, data: this.data, ...emojiProps }),
|
||||
)}
|
||||
|
||||
{emojis &&
|
||||
!emojis.length && (
|
||||
|
@ -211,5 +213,8 @@ export default class NimbleCategory extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
NimbleCategory.propTypes = { ...CategoryPropTypes, data: PropTypes.object.isRequired }
|
||||
NimbleCategory.propTypes = {
|
||||
...CategoryPropTypes,
|
||||
data: PropTypes.object.isRequired,
|
||||
}
|
||||
NimbleCategory.defaultProps = CategoryDefaultProps
|
||||
|
|
|
@ -5,7 +5,7 @@ import NimbleCategory from './category'
|
|||
|
||||
export default class Category extends React.Component {
|
||||
render() {
|
||||
return <NimbleCategory {...this.props} {...this.state}/>
|
||||
return <NimbleCategory {...this.props} {...this.state} />
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import NimbleEmoji from './emoji'
|
|||
|
||||
export default class Emoji extends React.PureComponent {
|
||||
render() {
|
||||
return <NimbleEmoji {...this.props} {...this.state}/>
|
||||
return <NimbleEmoji {...this.props} {...this.state} />
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import NimblePicker from './picker'
|
|||
|
||||
export default class Picker extends React.PureComponent {
|
||||
render() {
|
||||
return <NimblePicker {...this.props} {...this.state}/>
|
||||
return <NimblePicker {...this.props} {...this.state} />
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import NimblePreview from './preview'
|
|||
|
||||
export default class Preview extends React.PureComponent {
|
||||
render() {
|
||||
return <NimblePreview {...this.props} {...this.state}/>
|
||||
return <NimblePreview {...this.props} {...this.state} />
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import NimbleSearch from './search'
|
|||
|
||||
export default class Search extends React.PureComponent {
|
||||
render() {
|
||||
return <NimbleSearch {...this.props} {...this.state}/>
|
||||
return <NimbleSearch {...this.props} {...this.state} />
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -567,5 +567,8 @@ export default class NimblePicker extends React.PureComponent {
|
|||
}
|
||||
}
|
||||
|
||||
NimblePicker.propTypes = { ...PickerPropTypes, data: PropTypes.object.isRequired }
|
||||
NimblePicker.propTypes = {
|
||||
...PickerPropTypes,
|
||||
data: PropTypes.object.isRequired,
|
||||
}
|
||||
NimblePicker.defaultProps = { ...PickerDefaultProps }
|
||||
|
|
|
@ -41,7 +41,12 @@ export default class NimblePreview extends React.PureComponent {
|
|||
return (
|
||||
<div className="emoji-mart-preview">
|
||||
<div className="emoji-mart-preview-emoji">
|
||||
{NimbleEmoji({ key: emoji.id, emoji: emoji, data: this.data, ...emojiProps })}
|
||||
{NimbleEmoji({
|
||||
key: emoji.id,
|
||||
emoji: emoji,
|
||||
data: this.data,
|
||||
...emojiProps,
|
||||
})}
|
||||
</div>
|
||||
|
||||
<div className="emoji-mart-preview-data">
|
||||
|
@ -87,5 +92,8 @@ export default class NimblePreview extends React.PureComponent {
|
|||
}
|
||||
}
|
||||
|
||||
NimblePreview.propTypes = { ...PreviewPropTypes, data: PropTypes.object.isRequired }
|
||||
NimblePreview.propTypes = {
|
||||
...PreviewPropTypes,
|
||||
data: PropTypes.object.isRequired,
|
||||
}
|
||||
NimblePreview.defaultProps = PreviewDefaultProps
|
||||
|
|
|
@ -52,5 +52,8 @@ export default class NimbleSearch extends React.PureComponent {
|
|||
}
|
||||
}
|
||||
|
||||
NimbleSearch.propTypes = { ...SearchPropTypes, data: PropTypes.object.isRequired }
|
||||
NimbleSearch.propTypes = {
|
||||
...SearchPropTypes,
|
||||
data: PropTypes.object.isRequired,
|
||||
}
|
||||
NimbleSearch.defaultProps = SearchDefaultProps
|
||||
|
|
|
@ -36,7 +36,7 @@ export default class NimbleEmojiIndex {
|
|||
clearCustomEmojis(pool) {
|
||||
this.customEmojisList.forEach((emoji) => {
|
||||
let emojiId = emoji.id || emoji.short_names[0]
|
||||
|
||||
|
||||
delete pool[emojiId]
|
||||
delete emojisList[emojiId]
|
||||
})
|
||||
|
@ -53,7 +53,7 @@ export default class NimbleEmojiIndex {
|
|||
this.emojis[emojiId] = getSanitizedData(emoji, null, null, this.data)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
this.customEmojisList = custom
|
||||
this.index = {}
|
||||
}
|
||||
|
@ -62,7 +62,8 @@ export default class NimbleEmojiIndex {
|
|||
value,
|
||||
{ emojisToShowFilter, maxResults, include, exclude, custom = [] } = {},
|
||||
) {
|
||||
if (this.customEmojisList != custom) this.addCustomToPool(custom, this.originalPool)
|
||||
if (this.customEmojisList != custom)
|
||||
this.addCustomToPool(custom, this.originalPool)
|
||||
|
||||
maxResults || (maxResults = 75)
|
||||
include || (include = [])
|
||||
|
@ -90,7 +91,9 @@ export default class NimbleEmojiIndex {
|
|||
let isIncluded =
|
||||
include && include.length ? include.indexOf(category.id) > -1 : true
|
||||
let isExcluded =
|
||||
exclude && exclude.length ? exclude.indexOf(category.id) > -1 : false
|
||||
exclude && exclude.length
|
||||
? exclude.indexOf(category.id) > -1
|
||||
: false
|
||||
if (!isIncluded || isExcluded) {
|
||||
return
|
||||
}
|
||||
|
@ -173,7 +176,9 @@ export default class NimbleEmojiIndex {
|
|||
|
||||
if (results) {
|
||||
if (emojisToShowFilter) {
|
||||
results = results.filter((result) => emojisToShowFilter(pool[result.id]))
|
||||
results = results.filter((result) =>
|
||||
emojisToShowFilter(pool[result.id]),
|
||||
)
|
||||
}
|
||||
|
||||
if (results && results.length > maxResults) {
|
||||
|
@ -184,4 +189,3 @@ export default class NimbleEmojiIndex {
|
|||
return results
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ const EmojiDefaultProps = {
|
|||
forceSize: false,
|
||||
tooltip: false,
|
||||
backgroundImageFn: (set, sheetSize) =>
|
||||
`https://unpkg.com/emoji-datasource-${set}@${EMOJI_DATASOURCE_VERSION}/img/${set}/sheets-256/${sheetSize}.png`,
|
||||
`https://unpkg.com/emoji-datasource-${set}@${EMOJI_DATASOURCE_VERSION}/img/${set}/sheets-256/${sheetSize}.png`,
|
||||
onOver: () => {},
|
||||
onLeave: () => {},
|
||||
onClick: () => {},
|
||||
|
@ -83,7 +83,7 @@ const PickerPropTypes = {
|
|||
emoticons: PropTypes.arrayOf(PropTypes.string),
|
||||
keywords: PropTypes.arrayOf(PropTypes.string),
|
||||
imageUrl: PropTypes.string.isRequired,
|
||||
})
|
||||
}),
|
||||
),
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,6 @@ const PreviewDefaultProps = {
|
|||
onChange: () => {},
|
||||
}
|
||||
|
||||
|
||||
const SearchPropTypes = {
|
||||
onSearch: PropTypes.func,
|
||||
maxResults: PropTypes.number,
|
||||
|
|
Loading…
Reference in New Issue