Files
Arkie-Library-Frontend/src/components/messageStream/bubbles/ImageBubble.tsx

28 lines
902 B
TypeScript
Raw Normal View History

import type { Post } from "../../../types/post";
2026-05-27 12:33:26 +08:00
import { AttachmentDownloadPill } from "../AttachmentDownloadPill";
import { useLightbox } from "../overlays/ImageLightbox";
export function ImageBubble({ post }: { post: Post }) {
const { openLightbox } = useLightbox();
const att = post.attachments[0];
if (!att) return null;
return (
<div className="relative h-[180px] w-full overflow-hidden bg-black min-[440px]:h-[210px] md:h-[260px] lg:h-[300px]">
2026-05-27 12:33:26 +08:00
<button
type="button"
onClick={() => openLightbox([att], 0, undefined, post.id)}
className="block h-full w-full"
2026-05-27 12:33:26 +08:00
aria-label={att.filename}
>
<img
src={att.url}
alt={att.filename}
loading="lazy"
className="h-full w-full object-cover"
/>
</button>
<AttachmentDownloadPill postId={post.id} attachment={att} />
</div>
);
}