feat: carousel rotation

This commit is contained in:
Jack Merrill 2023-11-01 12:39:33 -04:00
parent 01da52e855
commit 60a5577a6b
No known key found for this signature in database

View File

@ -47,6 +47,17 @@ const Carousel = ({ pictures }: { pictures: Picture[] }) => {
} }
} }
useEffect(() => {
const int = setInterval(() => {
if (currentIndex < pictures.length - 1) {
setCurrentIndex((prevState) => prevState + 1);
} else {
setCurrentIndex(0);
}
}, 7500);
return () => clearInterval(int);
}, []);
return ( return (
<div className="relative w-full"> <div className="relative w-full">
<div <div