chore(examples): only use bundle

This commit is contained in:
moklick
2022-08-09 18:55:32 +02:00
parent affae72f7e
commit 0f835a2961
48 changed files with 194 additions and 513 deletions
@@ -1,12 +1,7 @@
import React, { FC } from 'react';
import { ConnectionLineComponentProps } from '@react-flow/core';
import { ConnectionLineComponentProps } from '@react-flow/bundle';
const ConnectionLine: FC<ConnectionLineComponentProps> = ({
fromX,
fromY,
toX,
toY,
}) => {
const ConnectionLine: FC<ConnectionLineComponentProps> = ({ fromX, fromY, toX, toY }) => {
return (
<g>
<path
@@ -16,14 +11,7 @@ const ConnectionLine: FC<ConnectionLineComponentProps> = ({
className="animated"
d={`M${fromX},${fromY} C ${fromX} ${toY} ${fromX} ${toY} ${toX},${toY}`}
/>
<circle
cx={toX}
cy={toY}
fill="#fff"
r={3}
stroke="#222"
strokeWidth={1.5}
/>
<circle cx={toX} cy={toY} fill="#fff" r={3} stroke="#222" strokeWidth={1.5} />
</g>
);
};
@@ -7,8 +7,9 @@ import {
Edge,
useNodesState,
useEdgesState,
} from '@react-flow/core';
import { Background, BackgroundVariant } from '@react-flow/background';
Background,
BackgroundVariant,
} from '@react-flow/bundle';
import ConnectionLine from './ConnectionLine';
@@ -25,10 +26,7 @@ const initialEdges: Edge[] = [];
const ConnectionLineFlow = () => {
const [nodes, , onNodesChange] = useNodesState(initialNodes);
const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges);
const onConnect = useCallback(
(params: Connection | Edge) => setEdges((eds) => addEdge(params, eds)),
[setEdges]
);
const onConnect = useCallback((params: Connection | Edge) => setEdges((eds) => addEdge(params, eds)), [setEdges]);
return (
<ReactFlow