2019-08-03 07:00:45 +01:00
|
|
|
import unicodeMapping from '../../features/emoji/emoji_unicode_mapping_light';
|
|
|
|
|
|
|
|
import './index.scss';
|
2019-07-02 08:10:25 +01:00
|
|
|
|
|
|
|
const assetHost = process.env.CDN_HOST || '';
|
|
|
|
|
2019-07-29 20:20:00 +01:00
|
|
|
export default class AutosuggestEmoji extends PureComponent {
|
2019-07-02 08:10:25 +01: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$/, '')];
|
|
|
|
|
2019-08-03 07:00:45 +01:00
|
|
|
if (!mapping) return null;
|
2019-07-02 08:10:25 +01:00
|
|
|
|
|
|
|
url = `${assetHost}/emoji/${mapping.filename}.svg`;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className='autosuggest-emoji'>
|
2019-08-03 07:00:45 +01:00
|
|
|
<img className='emojione' src={url} alt={emoji.native || emoji.colons} />
|
2019-07-02 08:10:25 +01:00
|
|
|
{emoji.colons}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|