react-code-dataset / nivo /packages /network /src /NetworkLink.tsx
Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
raw
history blame
766 Bytes
import { animated } from '@react-spring/web'
import { InputLink, InputNode, LinkProps } from './types'
import { memo } from 'react'
const NonMemoizedNetworkLink = <Node extends InputNode, Link extends InputLink>({
link,
animated: animatedProps,
blendMode,
}: LinkProps<Node, Link>) => (
<animated.line
data-testid={`link.${link.id}`}
stroke={animatedProps.color}
style={{ mixBlendMode: blendMode }}
strokeWidth={link.thickness}
strokeLinecap="round"
opacity={animatedProps.opacity}
x1={animatedProps.x1}
y1={animatedProps.y1}
x2={animatedProps.x2}
y2={animatedProps.y2}
/>
)
export const NetworkLink = memo(NonMemoizedNetworkLink) as typeof NonMemoizedNetworkLink