@lanaco/lnc-react-ui
Version:
React component library
26 lines (22 loc) • 2.46 kB
JavaScript
"use strict";const r=require("react/jsx-runtime"),s=require("react"),h=require("./emotion-styled.browser.esm-Cle7tAM9.cjs"),j=require("./consts-CtNoHdBj.cjs"),w=require("./Button.cjs"),a=require("./utils-NZLCh-J5.cjs"),q=require("./useDetectMobile-D6d5LpdL.cjs"),D=require("./style-DN1qT8BE.cjs"),m=require("./suspense-product-card-detailed-DtzOxHaH.cjs"),P=h.newStyled.div`
display: grid;
grid-template-columns: ${i=>`repeat(${i.limit}, minmax(0, 1fr))`};
gap: 1.25rem;
@media (max-width: ${j.MOBILE_SIZE_PX+"px"}) {
display: flex;
gap: 1rem;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
::-webkit-scrollbar {
-webkit-appearance: none;
}
-ms-overflow-style: none;
/* Internet Explorer 10+ */
scrollbar-width: none;
/* Firefox */
&::-webkit-scrollbar {
display: none;
/* Safari and Chrome */
}
}
`,u=s.memo(m.DetailedProductCard),k=s.forwardRef((i,p)=>{const{icon:l,title:g,buttonLink:c,items:t,buttonText:y,limit:o=4,onSelectCard:d=()=>{},onButtonAction:b=()=>{},isLoading:S=!1}=i,C=q.useDetectMobile(),f=s.useMemo(()=>r.jsx(r.Fragment,{children:C===!0?t==null?void 0:t.map((e,n)=>r.jsx(u,{title:e==null?void 0:e.title,price:e==null?void 0:e.price,currency:e==null?void 0:e.currency,image:e==null?void 0:e.image,sellerUuid:e==null?void 0:e.sellerUuid,uuid:e==null?void 0:e.uuid,isSponsored:e==null?void 0:e.isSponsored,imageComponent:e==null?void 0:e.imageComponent,onSelectCard:()=>d(e==null?void 0:e.uuid)},n)):t==null?void 0:t.slice(0,o).map((e,n)=>r.jsx(u,{title:e==null?void 0:e.title,price:e==null?void 0:e.price,currency:e==null?void 0:e.currency,image:e==null?void 0:e.image,sellerUuid:e==null?void 0:e.sellerUuid,uuid:e==null?void 0:e.uuid,location:e==null?void 0:e.location,isSponsored:e==null?void 0:e.isSponsored,imageComponent:e==null?void 0:e.imageComponent,onSelectCard:()=>d(e==null?void 0:e.uuid)},n))}),[t]);return r.jsxs(D.RegulatTitleSectionWrapper,{ref:p,children:[r.jsxs("div",{className:"regular-title",children:[r.jsxs("div",{className:"regular-title-text",children:[a.isDefinedNotEmptyString(l)&&r.jsx("i",{className:l}),r.jsx("span",{children:g})]}),a.isDefinedNotEmptyString(c)&&r.jsx(w,{type:"button",btnType:"tinted",color:"gray",onClick:()=>b(c),borderRadius:"curved",children:y})]}),r.jsx(P,{limit:o,children:r.jsx(m.SuspenseDetailedProductCard,{isLoading:S,itemsCount:o,keyPrefix:"explore-landing",children:f})})]})});module.exports=k;