soapbox/app/soapbox/features/emoji/components/emoji-picker.tsx

31 wiersze
658 B
TypeScript
Czysty Zwykły widok Historia

import { Picker as EmojiPicker } from 'emoji-mart';
2022-06-24 02:41:48 +00:00
import React, { useRef, useEffect } from 'react';
2020-03-27 20:59:38 +00:00
2022-07-11 20:09:41 +00:00
import { joinPublicPath } from 'soapbox/utils/static';
import data from '../data';
2022-07-09 17:02:21 +00:00
const getSpritesheetURL = (set: string) => {
2022-07-11 20:09:41 +00:00
return require('emoji-datasource/img/twitter/sheets/32.png');
};
const getImageURL = (set: string, name: string) => {
2022-07-11 20:09:41 +00:00
return joinPublicPath(`/packs/emoji/${name}.svg`);
};
function Picker(props: any) {
2022-06-26 03:55:17 +00:00
const ref = useRef(null);
2022-06-24 02:41:48 +00:00
useEffect(() => {
const input = { ...props, data, ref, getImageURL, getSpritesheetURL };
2022-06-24 02:41:48 +00:00
new EmojiPicker(input);
}, []);
return <div ref={ref} />;
}
2022-06-26 03:55:17 +00:00
export {
2022-06-29 08:25:57 +00:00
Picker,
};