import type { Attachment } from "@/lib/types"; import { Spinner } from "../ui/spinner"; import { CrossSmallIcon } from "./icons"; export const PreviewAttachment = ({ attachment, isUploading = false, onRemove, }: { attachment: Attachment; isUploading?: boolean; onRemove?: () => void; }) => { const { name, url, contentType } = attachment; return (
{contentType?.startsWith("image") ? ( // eslint-disable-next-line @next/next/no-img-element {name ) : (
File
)} {isUploading && (
)} {onRemove && !isUploading && ( )}
); };