import "./emoji.css";
import { useMemo } from "react";
import { EmojiTag } from "types";
export type EmojiProps = {
name: string;
url: string;
};
export function Emoji({ name, url }: EmojiProps) {
return
;
}
export function Emojify({
content,
emoji,
}: {
content: string;
emoji: EmojiTag[];
}) {
const emojified = useMemo(() => {
return content.split(/:(\w+):/g).map((i) => {
const t = emoji.find((t) => t[1] === i);
if (t) {
return ;
} else {
return i;
}
});
}, [content, emoji]);
return <>{emojified}>;
}