"use client";
import { motion } from "framer-motion";
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
import React from "react";
import { Autoplay, EffectCards, Navigation, Pagination } from "swiper/modules";
import { Swiper, SwiperSlide } from "swiper/react";
import "swiper/css/effect-cards";
import "swiper/css/pagination";
import "swiper/css/navigation";
import "swiper/css";
import { cn } from "@/lib/utils";
const Skiper48 = () => {
const images = [
{
src: "/images/x.com/13.jpeg",
alt: "Illustrations by my fav AarzooAly",
},
{
src: "/images/x.com/32.jpeg",
alt: "Illustrations by my fav AarzooAly",
},
{
src: "/images/x.com/20.jpeg",
alt: "Illustrations by my fav AarzooAly",
},
{
src: "/images/x.com/21.jpeg",
alt: "Illustrations by my fav AarzooAly",
},
{
src: "/images/x.com/19.jpeg",
alt: "Illustrations by my fav AarzooAly",
},
{
src: "/images/x.com/1.jpeg",
alt: "Illustrations by my fav AarzooAly",
},
{
src: "/images/x.com/2.jpeg",
alt: "Illustrations by my fav AarzooAly",
},
{
src: "/images/x.com/3.jpeg",
alt: "Illustrations by my fav AarzooAly",
},
{
src: "/images/x.com/4.jpeg",
alt: "Illustrations by my fav AarzooAly",
},
{
src: "/images/x.com/5.jpeg",
alt: "Illustrations by my fav AarzooAly",
},
{
src: "/images/x.com/6.jpeg",
alt: "Illustrations by my fav AarzooAly",
},
];
return (
<div className="flex h-full w-full items-center justify-center overflow-hidden bg-[#f5f4f3]">
<Carousel_002 className="" images={images} loop />
</div>
);
};
export { Skiper48 };
const Carousel_002 = ({
images,
className,
showPagination = false,
showNavigation = false,
loop = true,
autoplay = false,
spaceBetween = 40,
}: {
images: { src: string; alt: string }[];
className?: string;
showPagination?: boolean;
showNavigation?: boolean;
loop?: boolean;
autoplay?: boolean;
spaceBetween?: number;
}) => {
const css = `
.Carousal_002 {
padding-bottom: 50px !important;
}
`;
return (
<motion.div
initial={{ opacity: 0, translateY: 20 }}
animate={{ opacity: 1, translateY: 0 }}
transition={{
duration: 0.3,
delay: 0.5,
}}
className={cn("relative w-full max-w-3xl", className)}
>
<style>{css}</style>
<Swiper
spaceBetween={spaceBetween}
autoplay={
autoplay
? {
delay: 1000,
disableOnInteraction: false,
}
: false
}
effect="cards"
grabCursor={true}
loop={loop}
pagination={
showPagination
? {
clickable: true,
}
: false
}
navigation={
showNavigation
? {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
}
: false
}
className="Carousal_002 h-[380px] w-[260px]"
modules={[EffectCards, Autoplay, Pagination, Navigation]}
>
{images.map((image, index) => (
<SwiperSlide key={index} className="rounded-3xl">
<img
className="h-full w-full object-cover"
src={image.src}
alt={image.alt}
/>
</SwiperSlide>
))}
{showNavigation && (
<div>
<div className="swiper-button-next after:hidden">
<ChevronRightIcon className="h-6 w-6 text-white" />
</div>
<div className="swiper-button-prev after:hidden">
<ChevronLeftIcon className="h-6 w-6 text-white" />
</div>
</div>
)}
</Swiper>
</motion.div>
);
};
export { Carousel_002 };
/**
* Skiper 48 Carousel_002 — React + Swiper
* Built with Swiper.js - Read docs to learn more https://swiperjs.com/
* Illustrations by AarzooAly - https://x.com/AarzooAly
*
* License & Usage:
* - Free to use and modify in both personal and commercial projects.
* - Attribution to Skiper UI is required when using the free version.
* - No attribution required with Skiper UI Pro.
*
* Feedback and contributions are welcome.
*
* Author: @gurvinder-singh02
* Website: https://gxuri.in
* Twitter: https://x.com/Gur__vi
*/