-
-
Notifications
You must be signed in to change notification settings - Fork 1k
/
CircleSvg.tsx
36 lines (34 loc) · 947 Bytes
/
CircleSvg.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { animated } from '@react-spring/web'
import { CircleProps } from './types'
import { useNodeMouseHandlers } from './hooks'
export const CircleSvg = <RawDatum,>({
node,
style,
onMouseEnter,
onMouseMove,
onMouseLeave,
onClick,
}: CircleProps<RawDatum>) => {
const handlers = useNodeMouseHandlers<RawDatum>(node, {
onMouseEnter,
onMouseMove,
onMouseLeave,
onClick,
})
return (
<animated.circle
key={node.id}
cx={style.x}
cy={style.y}
r={style.radius}
fill={node.fill || style.color}
stroke={style.borderColor}
strokeWidth={style.borderWidth}
opacity={style.opacity}
onMouseEnter={handlers.onMouseEnter}
onMouseMove={handlers.onMouseMove}
onMouseLeave={handlers.onMouseLeave}
onClick={handlers.onClick}
/>
)
}