import { ChangeEvent, ReactNode } from 'react'; import { Trash2 } from 'lucide-react'; import { FormError } from '@@/form-components/FormError'; import { Button } from '@@/buttons'; import { Annotation } from './types'; interface Props { annotations: Annotation[]; handleAnnotationChange: ( index: number, key: 'Key' | 'Value', val: string ) => void; removeAnnotation: (index: number) => void; errors: Record; placeholder: string[]; } export function Annotations({ annotations, handleAnnotationChange, removeAnnotation, errors, placeholder, }: Props) { return ( <> {annotations.map((annotation, i) => (
Key ) => handleAnnotationChange(i, 'Key', e.target.value) } />
{errors[`annotations.key[${i}]`] && ( {errors[`annotations.key[${i}]`]} )}
Value ) => handleAnnotationChange(i, 'Value', e.target.value) } />
{errors[`annotations.value[${i}]`] && ( {errors[`annotations.value[${i}]`]} )}
))} ); }