refactor(examples): switch examples from cra to nextjs

This commit is contained in:
Christopher Möller
2022-07-19 17:23:26 +02:00
parent 62c417263c
commit be4dd6f1fa
86 changed files with 755 additions and 45859 deletions
@@ -0,0 +1,53 @@
import React, { FC } from 'react';
import {
EdgeProps,
getBezierPath,
EdgeText,
getBezierEdgeCenter,
} from '@react-flow/core';
const CustomEdge: FC<EdgeProps> = ({
id,
sourceX,
sourceY,
targetX,
targetY,
sourcePosition,
targetPosition,
data,
}) => {
const edgePath = getBezierPath({
sourceX,
sourceY,
sourcePosition,
targetX,
targetY,
targetPosition,
});
const [centerX, centerY] = getBezierEdgeCenter({
sourceX,
sourceY,
targetX,
targetY,
});
return (
<>
<path id={id} className='react-flow__edge-path' d={edgePath} />
<EdgeText
x={centerX}
y={centerY}
label={data.text}
labelStyle={{ fill: 'white' }}
labelShowBg
labelBgStyle={{ fill: 'red' }}
labelBgPadding={[2, 4]}
labelBgBorderRadius={2}
onClick={() => console.log(data)}
/>
;
</>
);
};
export default CustomEdge;