import React from 'react'; import { useEffect, useState } from 'react'; import './Carousel.css'; import p1 from '/engagement1.webp'; import p2 from '/engagement2.webp'; import p3 from '/engagement3.webp'; import p4 from '/engagement4.webp'; import p5 from '/engagement5.webp'; import p6 from '/engagement6.webp'; import useMediaQuery from '@mui/material/useMediaQuery'; import { AnimatePresence, motion } from 'framer-motion'; function Home() { const [currentIndex, setIndex] = useState(0); const photos = [p1, p2, p3, p4, p5, p6]; const isMobile = useMediaQuery('(max-width: 768px)'); useEffect(() => { const interval = setInterval(() => { setIndex((prevIndex) => (prevIndex + 1) % photos.length); }, 5000); return () => clearInterval(interval); }, [photos.length]); return (
{isMobile && ( )}
{isMobile && ( )}
); } export default Home;