SourceComparisonButton.tsx 702 B

1234567891011121314151617181920212223
  1. import { GitCompareArrows } from "lucide-react";
  2. import type { CanvasItem, OpenTarget } from "@/lib/types";
  3. interface Props {
  4. item: CanvasItem;
  5. onOpen: (item: CanvasItem, target: OpenTarget) => void;
  6. className?: string;
  7. }
  8. export function SourceComparisonButton({ item, onOpen, className = "nodeAction nodrag nopan" }: Props) {
  9. if (!("detailRef" in item) || !item.detailRef) return null;
  10. return <button
  11. type="button"
  12. className={`${className} lineageAction`}
  13. data-focus-return={`${item.id}:lineage`}
  14. onClick={(event) => {
  15. event.stopPropagation();
  16. onOpen(item, "lineage");
  17. }}
  18. >
  19. <GitCompareArrows aria-hidden="true" size={14} />数据来源
  20. </button>;
  21. }