"use client"; import "swiper/css/effect-coverflow"; import "swiper/css/pagination"; import "swiper/css/navigation"; import "swiper/css"; import "swiper/css/effect-cards"; import { ChevronLeft, ChevronRight } from "lucide-react"; import { useEffect, useRef, useState } from "react"; import { FaXTwitter } from "react-icons/fa6"; import type { Swiper as SwiperType } from "swiper"; import { Autoplay, EffectCoverflow } from "swiper/modules"; import { Swiper, SwiperSlide } from "swiper/react"; import { cn } from "@/lib/utils"; const TEAM = [ { src: "/block-media/shadcnblocks/block/lummi/person2.jpg", alt: "پرتره سارا احمدی در فضای شهری", name: "سارا احمدی", role: "سرپرست طراحی", url: "#", }, { src: "/block-media/shadcnblocks/block/lummi/person1.jpg", alt: "پرتره مریم رضایی در نور طبیعی", name: "مریم رضایی", role: "مدیر خلاق", url: "#", }, { src: "/block-media/shadcnblocks/block/lummi/person2.jpg", alt: "پرتره نیلوفر کریمی در استودیو", name: "نیلوفر کریمی", role: "مدیر محصول", url: "#", }, { src: "/block-media/shadcnblocks/block/lummi/person3.jpg", alt: "پرتره امیر حسینی", name: "امیر حسینی", role: "سرپرست طراحی", url: "#", }, { src: "/block-media/shadcnblocks/block/lummi/person1.jpg", alt: "پرتره لیلا محمدی در نور طبیعی", name: "لیلا محمدی", role: "مدیر خلاق", url: "#", }, { src: "/block-media/shadcnblocks/block/lummi/random11.jpg", alt: "پرتره کامران نظری در استودیو", name: "کامران نظری", role: "مدیر محصول", url: "#", }, ]; const css = ` .mySwiper22 { position: relative; z-index: 2; width: 100%; height: 350px; } .mySwiper22 .swiper-slide { width: 200px; height: 300px; border-radius: 0; opacity: 0.25; transition: opacity 0.3s ease-in-out; } .mySwiper22 .swiper-slide-active { opacity: 1; z-index: 10; } .mySwiper22 .swiper-slide img { display: block; width: 100%; height: 100%; object-fit: cover; } .mySwiper22.swiper-3d .swiper-slide-shadow-left, .mySwiper22.swiper-3d .swiper-slide-shadow-right { background: none; } `; interface Gallery22Props { className?: string; } const Gallery22 = ({ className }: Gallery22Props) => { const [activeIndex, setActiveIndex] = useState(0); const swiperRef = useRef(null); const swiperContainerRef = useRef(null); const [swiperReady, setSwiperReady] = useState(false); useEffect(() => { const swiper = swiperRef.current; if (!swiper || !swiperReady) { return; } const updateSwiper = () => { swiper.update(); swiper.slideToLoop(swiper.realIndex, 0); }; updateSwiper(); const container = swiperContainerRef.current; if (!container) { return; } const resizeObserver = new ResizeObserver(updateSwiper); resizeObserver.observe(container); return () => { resizeObserver.disconnect(); }; }, [swiperReady]); return (
{ swiperRef.current = instance; setSwiperReady(true); }} autoplay={{ delay: 1500, disableOnInteraction: false, }} breakpoints={{ 0: { spaceBetween: 40 }, 640: { spaceBetween: 70 }, 1024: { spaceBetween: 100 }, }} effect="coverflow" grabCursor={true} centeredSlides={true} loop={true} slidesPerView="auto" coverflowEffect={{ rotate: 0, stretch: 0, depth: 80, modifier: 2.5, }} className="mySwiper22" modules={[EffectCoverflow, Autoplay]} onSlideChange={(instance) => setActiveIndex(instance.realIndex)} > {TEAM.map((member, index) => ( {member.alt} {member.name} ))}

{TEAM[activeIndex].name}

{TEAM[activeIndex].role}

); }; export { Gallery22 };