Deploy
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
'use client'
|
||||
|
||||
import { useEmDashContent } from '@/hooks/useEmDashContent'
|
||||
import Image from 'next/image'
|
||||
import { useState } from 'react'
|
||||
|
||||
export default function TranquilMomentsGallerySection() {
|
||||
const { items, loading } = useEmDashContent('gallery')
|
||||
const [lightboxIndex, setLightboxIndex] = useState<number | null>(null)
|
||||
|
||||
if (loading) return <div className="flex justify-center py-16"><div className="w-8 h-8 rounded-full border-2 border-[#d4af37] border-t-transparent animate-spin" /></div>
|
||||
if (items.length === 0) return null
|
||||
|
||||
return (
|
||||
<section id="tranquil-moments-gallery" data-vula-section="tranquilmomentsgallery" data-vula-cms="gallery" className="py-20 bg-neutral-50">
|
||||
<div className="container mx-auto px-4">
|
||||
<h2 className="text-3xl font-bold text-center text-[#111827] mb-4">Tranquil Moments Gallery</h2>
|
||||
<p className="text-center text-[#8b5a3c] mb-12 max-w-2xl mx-auto">A visual journey through our peaceful oasis</p>
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
{items.map((item, index) => {
|
||||
const d = item.data as { title?: string; description?: string; image?: string }
|
||||
if (!d.image) return null
|
||||
return (
|
||||
<div key={item.id} className="group relative aspect-4/3 overflow-hidden rounded-xl cursor-pointer shadow-[var(--shadow-card)] hover:shadow-[var(--shadow-lifted)] transition-all duration-200" onClick={() => setLightboxIndex(index)}>
|
||||
<Image src={d.image} alt={d.title || 'Gallery image'} fill className="object-cover group-hover:scale-105 transition-transform duration-500 ease-out" sizes="(max-width: 768px) 100vw, 50vw" />
|
||||
<div className="absolute inset-0 bg-black/0 group-hover:bg-black/20 transition-colors duration-200 flex items-end p-4">
|
||||
<div className="text-white opacity-0 group-hover:opacity-100 transition-opacity duration-200">
|
||||
<h3 className="font-semibold text-lg">{d.title}</h3>
|
||||
{d.description && <p className="text-sm">{d.description}</p>}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Lightbox */}
|
||||
{lightboxIndex !== null && items[lightboxIndex] && (() => {
|
||||
const d = items[lightboxIndex].data as { title?: string; image?: string }
|
||||
return (
|
||||
<div className="fixed inset-0 bg-black/80 z-50 flex items-center justify-center p-4" onClick={() => setLightboxIndex(null)}>
|
||||
<div className="relative max-w-4xl w-full max-h-[90vh] aspect-video" onClick={(e) => e.stopPropagation()}>
|
||||
<Image src={d.image || ''} alt={d.title || 'Gallery image'} fill className="object-contain" sizes="100vw" />
|
||||
<button className="absolute top-2 right-2 bg-white/80 rounded-full p-2 text-[#111827] hover:bg-white" onClick={() => setLightboxIndex(null)}>✕</button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})()}
|
||||
</section>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user