hemshugdsc / LearningRoutesUI

0 stars 0 forks source link

Caraousel #1

Open hemshugdsc opened 10 months ago

hemshugdsc commented 10 months ago

Make the Carousel on top of container div looks like sticking on the top of image

hemshushivhare commented 10 months ago

import React, { useState, useEffect } from 'react';

const Carousel = ({ images }) => { const [startIndex, setStartIndex] = useState(0);

useEffect(() => { const slideInterval = setInterval(() => { setStartIndex((startIndex + 1) % images.length); }, 2000);

return () => {
  clearInterval(slideInterval);
};

}, [startIndex, images]);

const visibleImages = images.slice(startIndex, startIndex + 6); const shiftedImages = images.slice(0, 6 - visibleImages.length);

return (

{visibleImages.map((image, index) => ( {`Image ))} {shiftedImages.map((image, index) => ( {`Image ))}

); };

export default Carousel;

eugeneanokye99 commented 10 months ago

@hemshugdsc Can you assign me

Piyush07p commented 10 months ago

can you assign it to me