From a5dbd004045fa8201711c601a9141ede32383b7f Mon Sep 17 00:00:00 2001 From: Brad Traversy Date: Thu, 11 Jul 2024 08:09:26 -0400 Subject: [PATCH] Image gallery --- app/properties/[id]/page.jsx | 2 ++ components/PropertyImages.jsx | 44 +++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 components/PropertyImages.jsx diff --git a/app/properties/[id]/page.jsx b/app/properties/[id]/page.jsx index 58c9f3e..1b83199 100644 --- a/app/properties/[id]/page.jsx +++ b/app/properties/[id]/page.jsx @@ -2,6 +2,7 @@ import PropertyHeaderImage from '@/components/PropertyHeaderImage'; import PropertyDetails from '@/components/PropertyDetails'; import connectDB from '@/config/database'; import Property from '@/models/Property'; +import PropertyImages from '@/components/PropertyImages'; const PropertyPage = async ({ params }) => { await connectDB(); @@ -101,6 +102,7 @@ const PropertyPage = async ({ params }) => { + ); }; diff --git a/components/PropertyImages.jsx b/components/PropertyImages.jsx new file mode 100644 index 0000000..3acf793 --- /dev/null +++ b/components/PropertyImages.jsx @@ -0,0 +1,44 @@ +import Image from 'next/image'; + +const PropertyImages = ({ images }) => { + return ( +
+
+ {images.length === 1 ? ( + + ) : ( +
+ {images.map((image, index) => ( +
+ +
+ ))} +
+ )} +
+
+ ); +}; + +export default PropertyImages;