Get rid of custom components folder

This commit is contained in:
Jared Palmer 2024-11-15 10:14:25 -05:00
parent c493ac342b
commit 6d16f67280
38 changed files with 34 additions and 34 deletions

View file

@ -0,0 +1,43 @@
import { Attachment } from 'ai';
import { LoaderIcon } from './icons';
export const PreviewAttachment = ({
attachment,
isUploading = false,
}: {
attachment: Attachment;
isUploading?: boolean;
}) => {
const { name, url, contentType } = attachment;
return (
<div className="flex flex-col gap-2">
<div className="w-20 aspect-video bg-muted rounded-md relative flex flex-col items-center justify-center">
{contentType ? (
contentType.startsWith('image') ? (
// NOTE: it is recommended to use next/image for images
// eslint-disable-next-line @next/next/no-img-element
<img
key={url}
src={url}
alt={name ?? 'An image attachment'}
className="rounded-md size-full object-cover"
/>
) : (
<div className=""></div>
)
) : (
<div className=""></div>
)}
{isUploading && (
<div className="animate-spin absolute text-zinc-500">
<LoaderIcon />
</div>
)}
</div>
<div className="text-xs text-zinc-500 max-w-16 truncate">{name}</div>
</div>
);
};