refactor(examples): switch examples from cra to nextjs
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import React, { FC } from 'react';
|
||||
import { EdgeProps, getBezierPath } 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,
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<path id={id} className='react-flow__edge-path' d={edgePath} />
|
||||
<text>
|
||||
<textPath
|
||||
href={`#${id}`}
|
||||
style={{ fontSize: '12px' }}
|
||||
startOffset='50%'
|
||||
textAnchor='middle'
|
||||
>
|
||||
{data.text}
|
||||
</textPath>
|
||||
</text>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default CustomEdge;
|
||||
Reference in New Issue
Block a user