import { useState } from "react"; import { Drawer } from "antd"; import CommentTopic from "./CommentTopic"; import CommentListCard from "./CommentListCard"; import { IComment } from "./CommentItem"; interface IWidget { trigger?: JSX.Element; resId?: string; resType?: string; onCommentCountChange?: Function; } const Widget = ({ trigger, resId, resType, onCommentCountChange }: IWidget) => { const [open, setOpen] = useState(false); const [childrenDrawer, setChildrenDrawer] = useState(false); const [topicComment, setTopicComment] = useState(); console.log(resId, resType); const showDrawer = () => { setOpen(true); }; const onClose = () => { setOpen(false); }; const showChildrenDrawer = ( e: React.MouseEvent, comment: IComment ) => { setChildrenDrawer(true); setTopicComment(comment); }; const onChildrenDrawerClose = () => { setChildrenDrawer(false); }; return ( <> {trigger} { if (typeof onCommentCountChange !== "undefined") { onCommentCountChange(count); } }} /> {resId && resType ? ( ) : ( <> )} ); }; export default Widget;