{"version":3,"file":"Promotion_tile.cBtocchD.mjs","names":["useState","useRef","useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/mm9wtJ6rrsuIagf1yiSe/senL8GgFbHQ0mLSgypAR/Brand_logo.js","https:/framerusercontent.com/modules/wkbsbWHPNBP3su3KUdRS/0RTbjKnDicGy6YZAeLrX/Brand_logo_grid.js","https:/framerusercontent.com/modules/W7g6HJyCj51gNYcA9dCB/RHIQRkZpvWiOKFwp5fEC/Promotion_tile.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,Frame}from\"framer\";export default function BrandLogo({_name,_logo,_partnerId,_imageSuffix}){const handleClick=()=>{window.location.href=\"promotions?brand=\"+_partnerId;};return /*#__PURE__*/_jsx(Frame,{borderRadius:10,width:70,height:70,background:\"none\",onClick:handleClick,style:{cursor:\"pointer\"},children:/*#__PURE__*/_jsx(\"img\",{src:_imageSuffix+_logo,alt:\"Brand Logo\",style:{width:\"100%\",height:\"100%\"}})});}addPropertyControls(BrandLogo,{_imageSuffix:{type:ControlType.String,title:\"Image Suffix\",defaultValue:\"https://cdn.plusmoreplatform.com/\"},_name:{type:ControlType.String,title:\"Name\",defaultValue:\"PEP\"},_partnerId:{type:ControlType.String,title:\"Partner ID\",defaultValue:\"PEP\"},_logo:{type:ControlType.String,title:\"Logo\",defaultValue:\"71422529d64349798a70178d77303cc5.png\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"BrandLogo\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Brand_logo.map","import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import BrandLogo from\"https://framerusercontent.com/modules/mm9wtJ6rrsuIagf1yiSe/senL8GgFbHQ0mLSgypAR/Brand_logo.js\";export default function BrandLogoGrid({apiEndpoint,imageSuffix,width}){const[items,setItems]=useState();const[columns,setColumns]=useState(4);const[justifyContent,setJustifyContent]=useState(\"center\");const[outerDivWidth,setOuterDivWidth]=useState(0)// State to store the width\n;const outerDivRef=useRef(null);useEffect(()=>{if(!apiEndpoint)return;const handleResize=()=>{if(outerDivRef.current){const outerWidth=outerDivRef.current.offsetWidth;setJustifyContent(outerWidth>1e3?\"center\":\"left\");}};window.addEventListener(\"resize\",handleResize);handleResize();setJustifyContent(window.innerWidth<columns*80?\"center\":\"left\");fetch(apiEndpoint).then(response=>response.json()).then(data=>{if(Array.isArray(data.brands)&&data.brands.length>0){setItems(data.brands);}setColumns(data.brands.length);handleResize();}).catch(error=>console.error(\"Error fetching data:\",error));},[apiEndpoint,imageSuffix]);return /*#__PURE__*/_jsx(\"div\",{ref:outerDivRef,style:{gap:\"2px\",display:\"grid\",gridTemplateColumns:`repeat(${columns}, 70px)`,justifyContent:justifyContent,gridAutoFlow:\"column\"},children:items&&items.map((item,index)=>/*#__PURE__*/_jsx(\"div\",{style:{height:100,position:\"relative\"},children:/*#__PURE__*/_jsx(\"div\"// Wrap Promotion_Tile with a div for scaling\n    ,{style:{transform:`scale(1)`,transformOrigin:\"top left\"},children:/*#__PURE__*/_jsx(BrandLogo,{_name:item.name,_logo:item.logo,_partnerId:item.partnerId,_imageSuffix:imageSuffix})})},index))});}addPropertyControls(BrandLogoGrid,{apiEndpoint:{type:ControlType.String,title:\"API Endpoint\",defaultValue:\"https://promotions.plusmoreplatform.com/promotion/brands\"},imageSuffix:{type:ControlType.String,title:\"Image Suffix\",defaultValue:\"https://cdn.plusmoreplatform.com/\"},width:{type:ControlType.Number,title:\"Width\",defaultValue:100,min:100,//max: 1000,\nstep:10}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"BrandLogoGrid\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Brand_logo_grid.map","import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";import{addPropertyControls,ControlType,Frame}from\"framer\";export default function Promotion_Tile({_title,_imageSrc,_brandLogoSrc,_description}){const[title,setTitle]=useState(_title);const[description,setDescription]=useState(_description);const[imageSrc,setImageSrc]=useState(_imageSrc);const[brandLogoSrc,setBrandLogoSrc]=useState(_brandLogoSrc);const[isValid,setIsValid]=useState(true);useEffect(()=>{setTitle(title);setImageSrc(imageSrc);setBrandLogoSrc(brandLogoSrc);setDescription(description);},[]);if(!isValid)return /*#__PURE__*/_jsx(_Fragment,{});return /*#__PURE__*/_jsxs(Frame,{padding:0,borderRadius:10,backgroundColor:\"white\",initial:{filter:\"drop-shadow(0 3px 3px rgba(0, 0, 0, 0.3))\"},style:{width:\"200px\",height:\"300px\",display:\"flex\",flexDirection:\"column\",alignItems:\"flex-start\",justifyContent:\"flex-start\",boxSizing:\"border-box\",textAlign:\"left\",overflow:\"hidden\",/* Responsive breakpoints */\"@media (max-width: 1200px)\":{width:\"180px\",height:\"300px\",fontSize:\"0.875em\"},\"@media (max-width: 992px)\":{width:\"160px\",height:\"270px\",fontSize:\"0.75em\"},\"@media (max-width: 768px)\":{width:\"140px\",height:\"240px\",fontSize:\"20px\"},\"@media (max-width: 576px)\":{width:\"120px\",height:\"210px\",fontSize:\"20px\"}},children:[imageSrc&&/*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"flex-start\",overflow:\"hidden\"},children:/*#__PURE__*/_jsx(\"img\",{src:imageSrc,alt:\"Promotion\",style:{width:\"100%\",height:\"auto\",objectFit:\"contain\",borderRadius:10}})}),brandLogoSrc&&/*#__PURE__*/_jsx(\"div\",{style:{width:50,height:50,marginTop:10,marginLeft:10,display:\"flex\",justifyContent:\"flex-start\",alignItems:\"center\"},children:/*#__PURE__*/_jsx(\"img\",{src:brandLogoSrc,alt:\"Brand Logo\",style:{width:\"100%\",height:\"100%\",objectFit:\"contain\"}})}),/*#__PURE__*/_jsx(\"p\",{style:{fontFamily:\"DM Sans\",fontWeight:\"bold\",fontSize:18,marginTop:10,marginBottom:5,marginLeft:10},children:title}),/*#__PURE__*/_jsx(\"p\",{style:{fontFamily:\"DM Sans\",fontSize:14,marginBottom:5,marginLeft:10,color:\"#555\"},children:description})]});}addPropertyControls(Promotion_Tile,{_title:{type:ControlType.String,title:\"Title\",defaultValue:\"This is a promotion! This is a promotion! This is a promotion! \"},_imageSrc:{type:ControlType.String,title:\"Hero Image\",defaultValue:\"https://cdn.plusmoreplatform.com/c1cd49e782c14d64b7bf8d45f6f980ca.jpg\"},_brandLogoSrc:{type:ControlType.String,title:\"Brand Logo\",defaultValue:\"https://cdn.plusmoreplatform.com/ab21a7d495db4345aea62b812a74bb2d.png\"},_description:{type:ControlType.String,title:\"Description\",defaultValue:\"Starts now, ends later Starts now, ends later Starts now, ends later \"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Promotion_Tile\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Promotion_tile.map"],"mappings":"2NAAqG,SAAwB,EAAU,CAAC,QAAM,QAAM,aAAW,gBAAc,CAA8E,OAAoB,EAAK,EAAM,CAAC,aAAa,GAAG,MAAM,GAAG,OAAO,GAAG,WAAW,OAAO,YAA5I,CAAC,EAAO,SAAS,KAAK,oBAAoB,GAAsH,MAAM,CAAC,OAAO,UAAU,CAAC,SAAsB,EAAK,MAAM,CAAC,IAAI,EAAa,EAAM,IAAI,aAAa,MAAM,CAAC,MAAM,OAAO,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,sBAAlc,IAA0D,CAA0Y,EAAoB,EAAU,CAAC,aAAa,CAAC,KAAK,EAAY,OAAO,MAAM,eAAe,aAAa,oCAAoC,CAAC,M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