import { createElement } from 'react' import omit from 'lodash/omit.js' import { useSpring, animated } from '@react-spring/web' import { useMotionConfig } from '@nivo/core' import { useTheme } from '@nivo/theming' import { NoteSvg } from './types' export const AnnotationNote = ({ datum, x, y, note, }: { datum: Datum x: number y: number note: NoteSvg }) => { const theme = useTheme() const { animate, config: springConfig } = useMotionConfig() const animatedProps = useSpring({ x, y, config: springConfig, immediate: !animate, }) if (typeof note === 'function') { return createElement(note, { x, y, datum }) } return ( <> {theme.annotations.text.outlineWidth > 0 && ( {note} )} {note} ) }