2026-05-25 05:25:57 +08:00
|
|
|
import type { Post } from "../../../types/post";
|
2026-05-27 12:33:26 +08:00
|
|
|
import { AttachmentDownloadPill } from "../AttachmentDownloadPill";
|
2026-05-29 13:09:09 +08:00
|
|
|
import { BubbleImage } from "../BubbleImage";
|
2026-05-25 05:25:57 +08:00
|
|
|
import { useLightbox } from "../overlays/ImageLightbox";
|
|
|
|
|
|
|
|
|
|
export function ImageBubble({ post }: { post: Post }) {
|
|
|
|
|
const { openLightbox } = useLightbox();
|
|
|
|
|
const att = post.attachments[0];
|
|
|
|
|
if (!att) return null;
|
|
|
|
|
return (
|
2026-05-28 10:36:38 +08:00
|
|
|
<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)}
|
2026-05-28 10:36:38 +08:00
|
|
|
className="block h-full w-full"
|
2026-05-29 13:09:09 +08:00
|
|
|
aria-label="View image"
|
2026-05-27 12:33:26 +08:00
|
|
|
>
|
2026-05-29 13:09:09 +08:00
|
|
|
<BubbleImage
|
2026-05-27 12:33:26 +08:00
|
|
|
src={att.url}
|
|
|
|
|
loading="lazy"
|
|
|
|
|
className="h-full w-full object-cover"
|
|
|
|
|
/>
|
|
|
|
|
</button>
|
|
|
|
|
<AttachmentDownloadPill postId={post.id} attachment={att} />
|
|
|
|
|
</div>
|
2026-05-25 05:25:57 +08:00
|
|
|
);
|
|
|
|
|
}
|