Skip to content

Instantly share code, notes, and snippets.

@Daltonic
Created March 19, 2023 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Daltonic/48467114b5ca759bb0d52e8c4b79d7ed to your computer and use it in GitHub Desktop.
Save Daltonic/48467114b5ca759bb0d52e8c4b79d7ed to your computer and use it in GitHub Desktop.
DappBnb Project ImageSlider Component
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