2 lines
3.7 KiB
JavaScript
2 lines
3.7 KiB
JavaScript
import{j as e,S as u,N as v,u as j,s as x,aa as f}from"./index-i64aAU4V.js";import{P as S,l as m}from"./ProductCard-MuV835KW.js";import{S as h,N as g,a as p,A as P,b as w,c as N,D as V}from"./DistributorWord-CybNalS9.js";import{H as k}from"./HeaderLink-BQCnTJJZ.js";import{C as b}from"./Contact-0OxI9FLO.js";import"./index-Pshcj1b9.js";const y=({data:i,isLoading:s})=>{var r;return e.jsx("div",{className:"similar_Swiper",children:e.jsx(h,{dir:"ltr",slidesPerView:3,spaceBetween:66,breakpoints:{0:{slidesPerView:1},400:{slidesPerView:1},600:{slidesPerView:2},1e3:{slidesPerView:2},1200:{slidesPerView:3},1500:{slidesPerView:4}},navigation:!0,modules:[g,p,P,w],pagination:{clickable:!0},className:"mySwiper",children:s?e.jsx(u,{}):(r=i==null?void 0:i.data)==null?void 0:r.map((c,t)=>e.jsx(N,{children:e.jsx(S,{data:c})},t))})})},M=({category_id:i})=>{const{data:s,isLoading:r}=v({category_id:[i]}),{t:c}=j();return e.jsxs("div",{className:"similar_product",children:[e.jsx("h1",{children:c("Similar Products")}),e.jsx("main",{className:"ProductCards",children:e.jsx(y,{data:s,isLoading:r})})]})},C=({data:i})=>{const{t:s}=j(),r=i!=null&&i.collections?i.collections.flatMap(l=>{const{collectionParam:n,...a}=l;return Object.entries(a).map(([d,_])=>({key:d,value:_}))}):[],c=Math.ceil(r.length/2),t=r.slice(0,c),o=r.slice(c);return e.jsxs("div",{className:"product_info",children:[e.jsx("h1",{children:s("allocation")}),e.jsxs("div",{className:"details",children:[e.jsx("div",{className:"left",children:t.map(l=>e.jsxs("span",{children:[s(l.key)," ",e.jsx("span",{children:l.value})]}))}),e.jsx("div",{className:"right",children:o.map(l=>e.jsxs("span",{children:[s(l.key)," ",e.jsx("span",{children:l.value})]}))})]})]})},I=({data:i,isLoading:s})=>{var o,l,n;const[r,c]=x.useState(i==null?void 0:i.file);console.log((o=i==null?void 0:i.data)==null?void 0:o.attachment);const t=a=>{c(a)};return e.jsx("div",{className:"single_product_Swiper",children:e.jsx(h,{dir:"ltr",slidesPerView:3,spaceBetween:66,breakpoints:{0:{slidesPerView:1},400:{slidesPerView:2},600:{slidesPerView:2},1e3:{slidesPerView:3},1200:{slidesPerView:4},1500:{slidesPerView:4}},navigation:!0,modules:[g,p,P,w],pagination:{clickable:!0},className:"mySwiper",children:s?e.jsx(u,{}):(n=(l=i==null?void 0:i.data)==null?void 0:l.attachment)==null?void 0:n.map(({attachment:a,id:d})=>e.jsx(N,{children:e.jsx("div",{className:"image_container",onClick:()=>t(a),children:e.jsx("img",{src:a,alt:`product_multi_image_${d}`,className:"multi_image"})},d)},d))})})},G=()=>{const{data:i}=f(),s=i==null?void 0:i.data,[r]=j(),c=!1,t=s!=null&&s.params?Object.entries(s.params).map(([n,a])=>({key:n,value:a})):[],[o,l]=x.useState(s==null?void 0:s.file);return x.useEffect(()=>{l(s==null?void 0:s.file)},[s==null?void 0:s.file]),e.jsxs("div",{className:"single_product",children:[e.jsx("header",{children:e.jsx(k,{text:"Product name",isMulti:!0,extraText:"Product",extraLink:"/products"})}),e.jsxs("main",{children:[e.jsxs("div",{className:"single_product_container",children:[e.jsxs("div",{className:"single_product_left",children:[e.jsx("div",{className:"image_container main_image_container",children:e.jsx("img",{src:o,alt:`product ${s==null?void 0:s.name}`,className:"file"})}),e.jsx("div",{className:"gallery_product",children:e.jsx(I,{data:i,isLoading:c})})]}),e.jsxs("div",{className:"single_product_right",children:[e.jsx("h1",{children:m(s==null?void 0:s.name)}),t==null?void 0:t.map((n,a)=>e.jsx(V,{title:m(n==null?void 0:n.key)+": "+m(n==null?void 0:n.value)},a)),e.jsxs("div",{className:"manual",children:[e.jsx("img",{src:"/App/productManual.png",alt:"productManual"}),e.jsx("p",{children:r("Manuals")})]})]})]}),e.jsx(C,{data:s}),e.jsx(b,{}),e.jsx(M,{})]})]})};export{G as default};
|