30 lines
679 B
TypeScript
30 lines
679 B
TypeScript
import { Picker as EmojiPicker, PickerProps } from 'emoji-mart';
|
|
import React, { useRef, useEffect } from 'react';
|
|
|
|
import { joinPublicPath } from 'soapbox/utils/static';
|
|
|
|
import data from '../data';
|
|
|
|
const getSpritesheetURL = (set: string) => {
|
|
return require('emoji-datasource/img/twitter/sheets/32.png');
|
|
};
|
|
|
|
const getImageURL = (set: string, name: string) => {
|
|
return joinPublicPath(`/packs/emoji/${name}.svg`);
|
|
};
|
|
|
|
function Picker(props: PickerProps) {
|
|
const ref = useRef(null);
|
|
|
|
useEffect(() => {
|
|
const input = { ...props, data, ref, getImageURL, getSpritesheetURL };
|
|
|
|
new EmojiPicker(input);
|
|
}, []);
|
|
|
|
return <div ref={ref} />;
|
|
}
|
|
|
|
export {
|
|
Picker,
|
|
};
|