canvas.tsx 547 B

12345678910111213141516171819202122
  1. import { Background, ReactFlow, type ReactFlowProps } from '@xyflow/react';
  2. import type { ReactNode } from 'react';
  3. import '@xyflow/react/dist/style.css';
  4. type CanvasProps = ReactFlowProps & {
  5. children?: ReactNode;
  6. };
  7. export const Canvas = ({ children, ...props }: CanvasProps) => (
  8. <ReactFlow
  9. deleteKeyCode={['Backspace', 'Delete']}
  10. fitView
  11. panOnDrag={false}
  12. panOnScroll
  13. selectionOnDrag={true}
  14. zoomOnDoubleClick={false}
  15. {...props}
  16. >
  17. <Background bgColor="var(--sidebar)" />
  18. {children}
  19. </ReactFlow>
  20. );