Deploy
This commit is contained in:
@@ -0,0 +1,89 @@
|
|||||||
|
'use client'
|
||||||
|
|
||||||
|
import { useState } from 'react'
|
||||||
|
import { useVulaContent } from '@/hooks/useVulaContent'
|
||||||
|
import Modal from '@/components/ui/Modal'
|
||||||
|
import Image from 'next/image'
|
||||||
|
|
||||||
|
const IMAGE_PLACEHOLDER = 'https://images.pexels.com/photos/33783/olive-oil-salad-dressing-cooking-olive.jpg?auto=compress&cs=tinysrgb&w=400&h=300&fit=crop'
|
||||||
|
|
||||||
|
export default function RootedMomentsGallerySection() {
|
||||||
|
const [ selectedImage, setSelectedImage ] = useState<string | null>(null)
|
||||||
|
const { items, loading } = useVulaContent('gallery')
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return (
|
||||||
|
<div className="flex justify-center py-16">
|
||||||
|
<div className="w-8 h-8 rounded-full border-2 border-[#8b5a3c] border-t-transparent animate-spin" />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (items.length === 0) return null
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<section
|
||||||
|
id="rooted-moments-gallery"
|
||||||
|
data-vula-section="rootedmomentsgallery"
|
||||||
|
data-vula-cms="gallery"
|
||||||
|
className="py-20 bg-white"
|
||||||
|
>
|
||||||
|
<div className="container mx-auto px-4">
|
||||||
|
<h2 className="text-4xl font-bold text-[#21140d] mb-4 text-center">
|
||||||
|
Rooted Moments from Our Community
|
||||||
|
</h2>
|
||||||
|
<p className="text-[#16a34a] italic text-center mb-12 max-w-2xl mx-auto">
|
||||||
|
Real customers, real skin stories – straight from Pretoria
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4">
|
||||||
|
{items.map((item) => {
|
||||||
|
const d = item.data as {
|
||||||
|
title?: string
|
||||||
|
description?: string
|
||||||
|
image?: string
|
||||||
|
}
|
||||||
|
const imgSrc = d.image || IMAGE_PLACEHOLDER
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
key={item.id}
|
||||||
|
className="relative aspect-square overflow-hidden rounded-2xl cursor-pointer group"
|
||||||
|
onClick={() => setSelectedImage(imgSrc)}
|
||||||
|
>
|
||||||
|
<Image
|
||||||
|
src={imgSrc}
|
||||||
|
alt={d.title || 'Gallery photo'}
|
||||||
|
fill
|
||||||
|
sizes="(max-width: 768px) 50vw, (max-width: 1200px) 33vw, 25vw"
|
||||||
|
className="object-cover group-hover:scale-105 transition-transform duration-500 ease-out"
|
||||||
|
/>
|
||||||
|
<div className="absolute inset-0 bg-black/20 opacity-0 group-hover:opacity-100 transition-opacity duration-200 ease-out" />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<Modal
|
||||||
|
isOpen={selectedImage !== null}
|
||||||
|
onClose={() => setSelectedImage(null)}
|
||||||
|
className="max-w-4xl"
|
||||||
|
>
|
||||||
|
{selectedImage && (
|
||||||
|
<div className="relative w-full h-[70vh]">
|
||||||
|
<Image
|
||||||
|
src={selectedImage}
|
||||||
|
alt="Enlarged gallery photo"
|
||||||
|
fill
|
||||||
|
sizes="100vw"
|
||||||
|
className="object-contain"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</Modal>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user