'use client' import { ChevronLeftIcon, ChevronRightIcon } from '@heroicons/react/24/outline'; import { Mouse } from '@playwright/test'; import Image from 'next/image'; import React, { useState } from 'react'; const OfficeLightbox: React.FC = () => { const [selectedImage, setSelectedImage] = useState(null); const [currentIndex, setCurrentIndex] = useState(0); const images = [ '/office1.jpeg', '/office5.jpeg', '/office3.jpeg', '/office2.jpeg', '/office6.jpeg', '/office8.jpeg' ]; const openLightbox = (image: string, index: number) => { setSelectedImage(image); setCurrentIndex(index); }; const closeLightbox = () => { setSelectedImage(null); }; const handlePrev = (event: React.MouseEvent) => { event.stopPropagation(); setCurrentIndex(prevIndex => (prevIndex === 0 ? images.length -1 : prevIndex -1)); setSelectedImage(images[currentIndex -1 < 0 ? images.length -1 : currentIndex -1]); }; const handleNext = (event: React.MouseEvent) => { event.stopPropagation(); setCurrentIndex(prevIndex => (prevIndex === images.length -1 ? 0 : prevIndex +1)); setSelectedImage(images[currentIndex +1 >= images.length ? 0 : currentIndex +1]) } return (

Coworking copy

Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem quo quibusdam ipsam aliquid sequi, qui alias. Repellat quasi exercitationem impedit, officia odio veniam pariatur temporibus reprehenderit aspernatur, perferendis soluta quaerat.

{images.map((image, index) => ( {`Image openLightbox(image, index)} className="cursor-pointer" width={600} height={275} /> ))}
{/* Render the lightbox when an image is selected */} {selectedImage && (
Selected Image
)}
); }; export default OfficeLightbox;