2019-04-21 10:44:30 +00:00
|
|
|
import PropTypes from 'prop-types';
|
2023-05-28 14:38:10 +00:00
|
|
|
import { PureComponent } from 'react';
|
2019-04-21 10:44:30 +00:00
|
|
|
|
2022-10-11 08:41:15 +00:00
|
|
|
import { assetHost } from 'flavours/glitch/utils/config';
|
2019-04-21 10:44:30 +00:00
|
|
|
|
2023-11-15 11:01:51 +00:00
|
|
|
import { unicodeMapping } from '../features/emoji/emoji_unicode_mapping_light';
|
|
|
|
|
2023-05-28 12:18:23 +00:00
|
|
|
export default class AutosuggestEmoji extends PureComponent {
|
2019-04-21 10:44:30 +00:00
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
emoji: PropTypes.object.isRequired,
|
|
|
|
};
|
|
|
|
|
|
|
|
render () {
|
|
|
|
const { emoji } = this.props;
|
|
|
|
let url;
|
|
|
|
|
|
|
|
if (emoji.custom) {
|
|
|
|
url = emoji.imageUrl;
|
|
|
|
} else {
|
|
|
|
const mapping = unicodeMapping[emoji.native] || unicodeMapping[emoji.native.replace(/\uFE0F$/, '')];
|
|
|
|
|
|
|
|
if (!mapping) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
url = `${assetHost}/emoji/${mapping.filename}.svg`;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2023-11-15 20:58:43 +00:00
|
|
|
<div className='autosuggest-emoji'>
|
2019-04-21 10:44:30 +00:00
|
|
|
<img
|
|
|
|
className='emojione'
|
|
|
|
src={url}
|
|
|
|
alt={emoji.native || emoji.colons}
|
|
|
|
/>
|
|
|
|
|
2024-01-25 15:41:31 +00:00
|
|
|
<div className='autosuggest-emoji__name'>{emoji.colons}</div>
|
2019-04-21 10:44:30 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|