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