import { Attachment } from "ai"; import { LoaderIcon } from "./icons"; export const PreviewAttachment = ({ attachment, isUploading = false, }: { attachment: Attachment; isUploading?: boolean; }) => { const { name, url, contentType } = attachment; return ( (
{contentType ? ( contentType.startsWith("image") ? ( // NOTE: it is recommended to use next/image for images // eslint-disable-next-line @next/next/no-img-element ({name) ) : (
) ) : (
)} {isUploading && (
)}
{name}
) ); };