import { useComputedAnnotation } from './hooks' import { AnnotationNote } from './AnnotationNote' import { AnnotationLink } from './AnnotationLink' import { CircleAnnotationOutline } from './CircleAnnotationOutline' import { DotAnnotationOutline } from './DotAnnotationOutline' import { RectAnnotationOutline } from './RectAnnotationOutline' import { BoundAnnotation } from './types' import { isCircleAnnotation, isDotAnnotation, isRectAnnotation, isSvgNote } from './utils' export const Annotation = (annotation: BoundAnnotation) => { const { datum, x, y, note } = annotation const computed = useComputedAnnotation(annotation) if (!isSvgNote(note)) { throw new Error('note should be a valid react element') } return ( <> {isCircleAnnotation(annotation) && ( )} {isDotAnnotation(annotation) && ( )} {isRectAnnotation(annotation) && ( )} ) }