This commit is contained in:
Vula Builder
2026-07-27 18:34:54 +00:00
parent 083598da22
commit 0de9ddc2fa
@@ -0,0 +1,53 @@
'use client'
import { useVulaContent } from '@/hooks/useVulaContent'
import Image from 'next/image'
import { Card, CardContent } from '@/components/ui/Card'
import { useState } from 'react'
import Modal from '@/components/ui/Modal'
import { X } from 'lucide-react'
export default function GallerySection() {
const { items, loading } = useVulaContent('gallery')
const [selected, setSelected] = 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-[#dc2626] border-t-transparent animate-spin" /></div>
if (items.length === 0) return null
return (
<section id="gallery" data-vula-section="gallery" data-vula-cms="gallery" className="py-16 bg-white border-t-[3px] border-[#dc2626]">
<div className="container mx-auto px-4">
<h2 className="text-4xl font-black uppercase tracking-tight text-[#18181b] mb-2" style={{ fontFamily: 'Archivo Black, sans-serif', WebkitTextStroke: '0.5px currentColor' }}>#MzansiSwag</h2>
<p className="text-[#18181b]/70 uppercase tracking-widest text-sm mb-8">Real people, real fits tag us to be featured</p>
<div className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3">
{items.map((item, index) => {
const d = item.data as { title?: string; description?: string; image?: string }
return (
<div key={item.id} className="relative group cursor-pointer overflow-hidden border-[3px] border-[#18181b] shadow-[4px_4px_0_0_#18181b] transition-all duration-200 ease-out hover:shadow-[2px_2px_0_0_#dc2626] hover:-translate-x-[2px] hover:-translate-y-[2px]" onClick={() => setSelected(index)}>
<div className="relative aspect-square overflow-hidden">
{d.image && (
<Image src={d.image} alt={d.title || 'Gallery image'} fill sizes="(max-width: 768px) 50vw, 25vw" className="object-cover group-hover:scale-105 transition-transform duration-500 ease-out" />
)}
<div className="absolute inset-0 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-200 flex items-end p-2">
<p className="text-white text-xs font-bold uppercase">{d.title || 'Mzansi Swag'}</p>
</div>
</div>
</div>
)
})}
</div>
</div>
<Modal isOpen={selected !== null} onClose={() => setSelected(null)} className="max-w-2xl">
{selected !== null && items[selected] && (
<div className="relative p-4">
<button onClick={() => setSelected(null)} className="absolute top-2 right-2 z-10 bg-black/70 text-white p-1 rounded-full hover:bg-black"><X className="w-5 h-5" /></button>
<div className="relative aspect-[4/3] w-full">
<Image src={items[selected].data?.image || ''} alt={items[selected].data?.title || ''} fill sizes="100vw" className="object-contain" />
</div>
<div className="mt-4 text-center">
<h3 className="font-black uppercase text-lg text-[#18181b]">{items[selected].data?.title}</h3>
{items[selected].data?.description && <p className="text-sm text-gray-600 mt-1">{items[selected].data.description}</p>}
</div>
</div>
)}
</Modal>
</section>
)
}