TopicNode.tsx 528 B

123456789101112131415161718192021
  1. import React, { useEffect, useMemo, useRef } from "react";
  2. import { register } from "@antv/x6-react-shape";
  3. import { Graph, Node } from "@antv/x6";
  4. import type { TopicAreaInfo } from "@/type";
  5. const TopicAreaNode = ({ node, graph }: { node: Node; graph: Graph }) => {
  6. const { style, name } = node.getData<TopicAreaInfo>();
  7. return <div className="w-full h-full" style={style}>
  8. <p>{name}</p>
  9. </div>
  10. };
  11. register({
  12. shape: "topic-node",
  13. component: TopicAreaNode,
  14. width: 300,
  15. height: 300,
  16. effect: ["data"],
  17. });