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