import type { Attachment } from '@/lib/types'; import { Loader } from './elements/loader'; import { CrossSmallIcon, PencilEditIcon } from './icons'; import { Button } from './ui/button'; export const PreviewAttachment = ({ attachment, isUploading = false, onRemove, onEdit, }: { attachment: Attachment; isUploading?: boolean; onRemove?: () => void; onEdit?: () => void; }) => { const { name, url, contentType } = attachment; return (
{contentType?.startsWith('image') ? ( {name ) : (
File
)} {isUploading && (
)} {onRemove && !isUploading && ( )}
{name}
); };