DiscussionTopic.tsx 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { Divider } from "antd";
  2. import CommentTopicInfo from "./DiscussionTopicInfo";
  3. import CommentTopicChildren from "./DiscussionTopicChildren";
  4. import { IComment } from "./DiscussionItem";
  5. interface IWidget {
  6. topicId?: string;
  7. onItemCountChange?: Function;
  8. onTopicReady?: Function;
  9. }
  10. const DiscussionTopicWidget = ({
  11. topicId,
  12. onTopicReady,
  13. onItemCountChange,
  14. }: IWidget) => {
  15. return (
  16. <>
  17. <CommentTopicInfo
  18. topicId={topicId}
  19. onReady={(value: IComment) => {
  20. console.log("on Topic Ready", value);
  21. if (typeof onTopicReady !== "undefined") {
  22. onTopicReady(value);
  23. }
  24. }}
  25. />
  26. <Divider />
  27. <CommentTopicChildren
  28. topicId={topicId}
  29. onItemCountChange={(count: number, e: string) => {
  30. //把新建回答的消息传出去。
  31. if (typeof onItemCountChange !== "undefined") {
  32. onItemCountChange(count, e);
  33. }
  34. }}
  35. />
  36. </>
  37. );
  38. };
  39. export default DiscussionTopicWidget;