Skip to content

Commit c8d9520

Browse files
committed
Merge branch 'preview'
2 parents 96e3c1d + 979f1ec commit c8d9520

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

src/components/dataDisplay/postEmbed/ImageEmbed.tsx

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default function ImageEmbed(props: Props) {
1818

1919
const generateImageLayout = (
2020
count: number,
21-
images: AppBskyEmbedImages.ViewImage[]
21+
images: AppBskyEmbedImages.ViewImage[],
2222
) => {
2323
// adjust image grid layout based on number of images
2424
switch (count) {
@@ -129,19 +129,23 @@ export default function ImageEmbed(props: Props) {
129129
default:
130130
return (
131131
<div className="relative">
132-
<Image
133-
src={images[0].thumb}
134-
alt={images[0].alt}
135-
width={images[0].aspectRatio?.width ?? 900}
136-
height={images[0].aspectRatio?.height ?? 900}
137-
priority
138-
className="rounded-md max-h-96 w-full object-cover cursor-pointer hover:brightness-90"
139-
onClick={(e) => {
140-
e.stopPropagation();
141-
setShowImage(0);
142-
}}
143-
/>
144-
{images[0].alt && <AltTag text={images[0].alt} />}
132+
{images[0] && (
133+
<>
134+
<Image
135+
src={images[0].thumb}
136+
alt={images[0].alt}
137+
width={images[0].aspectRatio?.width ?? 900}
138+
height={images[0].aspectRatio?.height ?? 900}
139+
priority
140+
className="rounded-md max-h-96 w-full object-cover cursor-pointer hover:brightness-90"
141+
onClick={(e) => {
142+
e.stopPropagation();
143+
setShowImage(0);
144+
}}
145+
/>
146+
{images[0].alt && <AltTag text={images[0].alt} />}
147+
</>
148+
)}
145149
</div>
146150
);
147151
}

0 commit comments

Comments
 (0)