/ImageSlider.jsx Secret
Created
March 19, 2023 15:15
DappBnb Project ImageSlider Component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Swiper, SwiperSlide } from "swiper/react"; | |
import { Autoplay, Pagination, Navigation } from "swiper"; | |
const ImageSlider = ({ images }) => { | |
return ( | |
<Swiper | |
spaceBetween={30} | |
centeredSlides={true} | |
autoplay={{ | |
delay: 2500, | |
disableOnInteraction: false, | |
}} | |
pagination={{ | |
clickable: true, | |
}} | |
navigation={false} | |
modules={[Autoplay, Pagination, Navigation]} | |
className="w-96 h-52 rounded-t-2xl overflow-hidden" | |
> | |
{images.map((url, i) => ( | |
<SwiperSlide key={i}> | |
<img | |
className="w-full" | |
src={url} | |
alt="image slide 1" | |
/> | |
</SwiperSlide> | |
))} | |
</Swiper> | |
); | |
}; | |
export default ImageSlider; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment