"use client"; // <-- This line is crucial import React, { useState, useEffect, useRef } from 'react'; import clsx from 'clsx'; const cards = [ { image: '/images/act1.png', title: 'Yoga', description: 'Step fully into your body. The perfect start to the morning.', }, { image: '/images/act2.png', title: 'Nutrition', description: 'Discover a variety of dietary options tailored to your health and wellness needs.', }, { image: '/images/act3.png', title: 'Meditation', description: 'Enhance your mental clarity and inner peace through guided meditation practices.', }, { image: '/images/act4.png', title: 'Massage', description: 'Profound relaxation through massage sessions, harmonizing with the high energies of Egypt.', }, { image: '/images/act5.png', title: 'Workshops', description: 'Healing sessions and workshops designed to enrich your well-being', }, { image: '/images/act6.png', title: 'Excursions', description: 'Experience unforgettable adventures with our curated Nile excursions.', }, ]; const MultiCardCarousel = () => { const [currentIndex, setCurrentIndex] = useState(0); const [isMobile, setIsMobile] = useState(false); // Start with false, will be updated in useEffect const scrollRef = useRef(null); useEffect(() => { const handleResize = () => { setIsMobile(window.innerWidth < 640); }; window.addEventListener('resize', handleResize); // Clean up the event listener on component unmount return () => window.removeEventListener('resize', handleResize); }, []); const handleNext = () => { setCurrentIndex((prevIndex) => { const nextIndex = (prevIndex + (isMobile ? 1 : 3)) % cards.length; return nextIndex; }); }; const handlePrev = () => { setCurrentIndex((prevIndex) => { const prevIndexAdjusted = (prevIndex - (isMobile ? 1 : 3) + cards.length) % cards.length; return prevIndexAdjusted; }); }; // Determine the number of cards to display based on screen size const displayCards = isMobile ? [cards[currentIndex]] : cards.slice(currentIndex, currentIndex + 3); return (

Activities

Explore a diverse range of activities designed to elevate your Mind, Body, and Soul, fostering a deeper connection and holistic well-being.

{cards.map((card, index) => (
{card.title}

{card.title}

{card.description}

))}
); }; export default MultiCardCarousel;