/* Berlin Döner Rauma — gallery page */
const THEME_URL = (document.getElementById('berlin-doner-gallery-js')?.src.replace('/assets/gallery-app.jsx', '').split('?')[0])
|| 'https://berlin2.demowpsite.com/wp-content/themes/berlin-doner-rauma';
const { useState, useEffect, useCallback } = React;
const IMAGES = Array.from({ length: 20 }, (_, i) => ({
src: `${THEME_URL}/assets/gallery/gallery-${i + 1}.png`,
alt: `Berlin Döner Rauma gallery image ${i + 1}`,
}));
function Lightbox({ images, index, onClose, onPrev, onNext }) {
useEffect(() => {
function onKey(e) {
if (e.key === 'Escape') onClose();
if (e.key === 'ArrowLeft') onPrev();
if (e.key === 'ArrowRight') onNext();
}
document.addEventListener('keydown', onKey);
return () => document.removeEventListener('keydown', onKey);
}, [onClose, onPrev, onNext]);
const btnBase = {
position: 'absolute', top: '50%', transform: 'translateY(-50%)',
background: 'rgba(255,255,255,0.1)', border: '1px solid rgba(255,255,255,0.2)',
color: '#fff', fontSize: 28, width: 52, height: 52, borderRadius: '50%',
cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center',
zIndex: 10,
};
return (
![{images[index].alt}]({images[index].src})
e.stopPropagation()}
style={{ maxWidth: '90vw', maxHeight: '90vh', objectFit: 'contain', borderRadius: 4, display: 'block' }}
/>
{index + 1} / {images.length}
);
}
function GalleryPage() {
const [lightboxIndex, setLightboxIndex] = useState(null);
const openLightbox = useCallback((i) => setLightboxIndex(i), []);
const closeLightbox = useCallback(() => setLightboxIndex(null), []);
const prevImage = useCallback(() => setLightboxIndex(i => Math.max(0, i - 1)), []);
const nextImage = useCallback(() => setLightboxIndex(i => Math.min(IMAGES.length - 1, i + 1)), []);
return (
{/* Hero */}
Our Restaurant
A Taste of
Berlin in Rauma.
{/* Masonry grid */}
{IMAGES.map((img, i) => (
openLightbox(i)}
style={{ breakInside: 'avoid', marginBottom: '12px', cursor: 'pointer', borderRadius: 4, overflow: 'hidden' }}
>

e.currentTarget.style.opacity = '0.85'}
onMouseLeave={e => e.currentTarget.style.opacity = '1'}
/>
))}
{lightboxIndex !== null && (
)}
);
}
const galleryEl = document.getElementById('gallery-root');
if (galleryEl) ReactDOM.createRoot(galleryEl).render();