Skip to content

Commit b2fce31

Browse files
PDP: render ProductGallery only when images are available
Co-Authored-By: Adrian | JS Mastery <contact@jsmastery.pro>
1 parent 03ec5ae commit b2fce31

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/app/(root)/products/[id]/page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,9 @@ export default async function ProductDetailPage({ params }: { params: Promise<{
155155
</nav>
156156

157157
<section className="grid grid-cols-1 gap-10 lg:grid-cols-[1fr_480px]">
158-
<ProductGallery productId={product.id} variants={galleryVariants} className="lg:sticky lg:top-6" />
158+
{galleryVariants.length > 0 && (
159+
<ProductGallery productId={product.id} variants={galleryVariants} className="lg:sticky lg:top-6" />
160+
)}
159161

160162
<div className="flex flex-col gap-6">
161163
<header className="flex flex-col gap-2">

0 commit comments

Comments
 (0)