2022-11-27 18:02:32 +00:00
|
|
|
import { Component } from "inferno";
|
|
|
|
import { getEmojiMart } from "../../utils";
|
|
|
|
|
|
|
|
interface EmojiMartProps {
|
2023-03-27 16:49:46 +00:00
|
|
|
onEmojiClick?(val: any): any;
|
|
|
|
pickerOptions: any;
|
2022-11-27 18:02:32 +00:00
|
|
|
}
|
|
|
|
|
2023-03-27 16:49:46 +00:00
|
|
|
export class EmojiMart extends Component<EmojiMartProps> {
|
|
|
|
constructor(props: any, context: any) {
|
|
|
|
super(props, context);
|
|
|
|
this.handleEmojiClick = this.handleEmojiClick.bind(this);
|
|
|
|
}
|
|
|
|
componentDidMount() {
|
|
|
|
let div: any = document.getElementById("emoji-picker");
|
|
|
|
if (div) {
|
|
|
|
div.appendChild(
|
|
|
|
getEmojiMart(this.handleEmojiClick, this.props.pickerOptions)
|
|
|
|
);
|
2022-11-27 18:02:32 +00:00
|
|
|
}
|
2023-03-27 16:49:46 +00:00
|
|
|
}
|
2022-11-27 18:02:32 +00:00
|
|
|
|
2023-03-27 16:49:46 +00:00
|
|
|
render() {
|
|
|
|
return <div id="emoji-picker"></div>;
|
|
|
|
}
|
2022-11-27 18:02:32 +00:00
|
|
|
|
2023-03-27 16:49:46 +00:00
|
|
|
handleEmojiClick(e: any) {
|
|
|
|
this.props.onEmojiClick?.(e);
|
|
|
|
}
|
2022-11-27 18:02:32 +00:00
|
|
|
}
|