feat: carousel rotation
This commit is contained in:
parent
01da52e855
commit
60a5577a6b
|
@ -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 (
|
||||
<div className="relative w-full">
|
||||
<div
|
||||
|
|
Loading…
Reference in New Issue
Block a user