import{j as e}from"./jsx-runtime.D_zvdyIk.js";import{r as s}from"./index.2yJIXLcc.js";import{N as g,H as j,a as v}from"./navigation.DjKHjJDo.js";/* empty css                       */import{P as w}from"./pagination.CSD-W6zp.js";import{S as N,a as b}from"./swiper-react.BpyM6VYm.js";import"./iconBase.Blz05Vck.js";const S=()=>e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-x-6",children:Array(3).fill(0).map((t,r)=>e.jsx("div",{className:"h-[150px] md:h-[250px] lg:h-[306px] rounded-md animate-pulse bg-neutral-200 dark:bg-neutral-700"},r))}),B=({collections:t})=>{const[r,c]=s.useState(!1),[u,a]=s.useState(!1),[m,p]=s.useState([]),[x,h]=s.useState(!0),i=s.useRef(null),o=s.useRef(null);return s.useEffect(()=>{p(t),h(!1)},[t]),x?e.jsx(S,{}):e.jsx("div",{className:"relative",onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:e.jsxs(N,{modules:[w,g],slidesPerView:2,spaceBetween:10,breakpoints:{640:{slidesPerView:2,spaceBetween:20},768:{slidesPerView:3,spaceBetween:24},1024:{slidesPerView:3,spaceBetween:24}},navigation:{prevEl:i.current,nextEl:o.current},onInit:()=>c(!0),children:[m?.map(l=>{const{title:n,handle:d,image:f}=l;return e.jsx(b,{children:e.jsxs("div",{className:"text-center relative",children:[e.jsx("img",{src:f?.url,width:424,height:306,alt:n,className:"h-[150px] md:h-[250px] lg:h-[306px] object-cover rounded-md"}),e.jsxs("div",{className:"py-6",children:[e.jsx("h3",{className:"mb-2 font-medium h4",children:e.jsx("a",{className:"after:absolute after:inset-0",href:`/products?c=${d}`,children:n})}),e.jsxs("p",{className:"text-light dark:text-darkmode-light text-xs md:text-xl",children:[l.products?.edges.length," items"]})]})]})},d)}),e.jsxs("div",{className:`hidden md:block w-full absolute top-[33%] z-10 px-4 text-dark ${u?"opacity-100 transition-opacity duration-300 ease-in-out":"opacity-0 transition-opacity duration-300 ease-in-out"}`,children:[e.jsx("div",{ref:i,className:"p-2 lg:p-3 rounded-md bg-body cursor-pointer shadow-sm absolute left-4",children:e.jsx(j,{size:24})}),e.jsx("div",{ref:o,className:"p-2 lg:p-3 rounded-md bg-body cursor-pointer shadow-sm absolute right-4",children:e.jsx(v,{size:24})})]})]})})};export{B as default};
