Deploy
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
'use client'
|
||||
|
||||
import { useEmDashContent } from '@/hooks/useEmDashContent'
|
||||
import Image from 'next/image'
|
||||
import { useState } from 'react'
|
||||
import { X } from 'lucide-react'
|
||||
|
||||
export default function BushGallerySection() {
|
||||
const { items, loading } = useEmDashContent('gallery')
|
||||
const [lightboxItem, setLightboxItem] = useState<{ title?: string; description?: string; image?: string } | null>(null)
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<div className="flex justify-center py-16">
|
||||
<div className="w-8 h-8 rounded-full border-2 border-current border-t-transparent animate-spin" />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
if (items.length === 0) return null
|
||||
|
||||
return (
|
||||
<section
|
||||
id="bush-gallery"
|
||||
data-vula-section="bushgallery"
|
||||
data-vula-cms="gallery"
|
||||
className="py-20 bg-[#f7f9f4]"
|
||||
>
|
||||
<div className="max-w-7xl mx-auto px-4">
|
||||
<h2 className="font-heading text-4xl md:text-5xl text-[#1b210d] mb-4 leading-tight">
|
||||
Light through the leaves
|
||||
</h2>
|
||||
<p className="font-serif italic text-lg text-[#8b5a3c] max-w-2xl mb-12">
|
||||
Moments that make the bush feel like home.
|
||||
</p>
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
{items.map((item) => {
|
||||
const d = item.data as { title?: string; description?: string; image?: string }
|
||||
return (
|
||||
<button
|
||||
key={item.id}
|
||||
onClick={() => setLightboxItem(d)}
|
||||
className="group relative overflow-hidden rounded-2xl aspect-square cursor-pointer transition-all duration-200 ease-out hover:-translate-y-1 hover:shadow-lg"
|
||||
>
|
||||
<Image
|
||||
src={d.image || '/placeholder.jpg'}
|
||||
alt={d.title || 'Gallery image'}
|
||||
fill
|
||||
sizes="(max-width: 640px) 100vw, (max-width: 1024px) 50vw, 33vw"
|
||||
className="object-cover transition-transform duration-500 ease-out group-hover:scale-105"
|
||||
/>
|
||||
<div className="absolute inset-0 bg-black/20 opacity-0 group-hover:opacity-100 transition-opacity duration-200 ease-out" />
|
||||
<div className="absolute bottom-0 left-0 right-0 p-4 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-200 ease-out">
|
||||
<p className="text-white font-semibold text-sm">{d.title || ''}</p>
|
||||
{d.description && (
|
||||
<p className="text-white/80 text-xs mt-1">{d.description}</p>
|
||||
)}
|
||||
</div>
|
||||
</button>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Lightbox */}
|
||||
{lightboxItem && (
|
||||
<div
|
||||
className="fixed inset-0 z-50 bg-black/80 flex items-center justify-center p-4"
|
||||
onClick={() => setLightboxItem(null)}
|
||||
>
|
||||
<div
|
||||
className="relative max-w-4xl w-full max-h-[90vh] bg-[#f7f9f4] rounded-2xl overflow-hidden"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<button
|
||||
onClick={() => setLightboxItem(null)}
|
||||
className="absolute top-4 right-4 z-10 p-2 bg-black/30 rounded-full text-white hover:bg-black/50 transition-colors"
|
||||
>
|
||||
<X className="w-5 h-5" />
|
||||
</button>
|
||||
<div className="relative h-[60vh] w-full">
|
||||
<Image
|
||||
src={lightboxItem.image || '/placeholder.jpg'}
|
||||
alt={lightboxItem.title || 'Full view'}
|
||||
fill
|
||||
sizes="100vw"
|
||||
className="object-contain"
|
||||
/>
|
||||
</div>
|
||||
{(lightboxItem.title || lightboxItem.description) && (
|
||||
<div className="p-6 bg-[#f5f5dc]">
|
||||
{lightboxItem.title && (
|
||||
<h3 className="text-2xl font-heading text-[#1b210d]">{lightboxItem.title}</h3>
|
||||
)}
|
||||
{lightboxItem.description && (
|
||||
<p className="font-serif italic text-[#1b210d]/80 mt-2">{lightboxItem.description}</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user