{"version":3,"file":"TestSlate.DfpobSRD.mjs","names":["useState","__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","_e","p","c","init_jsx_runtime","ce","window","addPropertyControls","init_framer_Bf4_tcb2","ControlType","SlateGrid","clips","setClips","loading","setLoading","error","setError","showreelData","setShowreelData","windowWidth","setWindowWidth","handleResize","getGridColumns","fetchShowreelData","apiUrl","props","response","data","clipsWithUrls","clip","err","index","totalColumns","currentRow","currentCol","init_TestSlate"],"sources":["https:/framerusercontent.com/modules/cJkPn529BZVuxb8l4ZCw/PXIlIMpxtvBzX1V2oa4T/TestSlate.js"],"sourcesContent":["// Get Started: https://www.framer.com/developers\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";/*\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */import{useState,useEffect}from\"react\";export default function SlateGrid(props){const[clips,setClips]=useState([]);const[loading,setLoading]=useState(true);const[error,setError]=useState(null);const[showreelData,setShowreelData]=useState(null);const[windowWidth,setWindowWidth]=useState(typeof window!==\"undefined\"?window.innerWidth:1024);useEffect(()=>{const handleResize=()=>setWindowWidth(window.innerWidth);window.addEventListener(\"resize\",handleResize);return()=>window.removeEventListener(\"resize\",handleResize);},[]);const getGridColumns=()=>{if(windowWidth>768)return\"repeat(3, 1fr)\";if(windowWidth>480)return\"repeat(2, 1fr)\";return\"1fr\";};const fetchShowreelData=async()=>{const apiUrl=`https://morganandnick.slateapp.com/api/v1/showreel/${props.showreelId}?access_token=316887a6a3ee48cd902ab509baab2310`;try{setLoading(true);setError(null);const response=await fetch(apiUrl);console.log(response);if(!response.ok){throw new Error(`HTTP error! status: ${response.status}`);}const data=await response.json();if(data.code!==200){throw new Error(`API error: ${data.message}`);}setShowreelData(data.response);// Store clips that have embedded_url\nconst clipsWithUrls=data.response.clips?.filter(clip=>clip.embedded_url)||[];setClips(clipsWithUrls);}catch(err){setError(err instanceof Error?err.message:\"An unknown error occurred\");}finally{setLoading(false);}};useEffect(()=>{fetchShowreelData();},[]);const handleRefresh=()=>{fetchShowreelData();};if(loading){return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",margin:\"0 auto\"},children:/*#__PURE__*/_jsx(\"div\",{style:{boxShadow:\"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)\"},children:/*#__PURE__*/_jsx(\"div\",{style:{},children:/*#__PURE__*/_jsx(\"div\",{style:{display:\"grid\",gridTemplateColumns:getGridColumns(),gap:\"0px\"},children:[1,2,3,4,5,6].map(index=>/*#__PURE__*/_jsx(\"div\",{style:{},children:/*#__PURE__*/_jsx(\"div\",{style:{aspectRatio:\"16/9\",backgroundColor:\"transparent\",overflow:\"hidden\",border:\"solid\",borderColor:\"rgba(255,255,255,0.1)\",borderWidth:\"2px\",position:\"relative\"}})},index))})})})});}if(error){return /*#__PURE__*/_jsx(\"div\",{style:{padding:\"24px\",maxWidth:\"1024px\",margin:\"0 auto\"},children:/*#__PURE__*/_jsxs(\"div\",{style:{backgroundColor:\"#fef2f2\",border:\"1px solid #fecaca\",padding:\"16px\"},children:[/*#__PURE__*/_jsx(\"h2\",{style:{color:\"#991b1b\",fontWeight:\"600\",marginBottom:\"8px\"},children:\"Error\"}),/*#__PURE__*/_jsx(\"p\",{style:{color:\"#dc2626\",marginBottom:\"16px\"},children:error}),/*#__PURE__*/_jsx(\"button\",{onClick:handleRefresh,style:{padding:\"8px 16px\",backgroundColor:\"#dc2626\",color:\"white\",border:\"none\",cursor:\"pointer\",transition:\"background-color 0.2s\"},onMouseOver:e=>{e.currentTarget.style.backgroundColor=\"#b91c1c\";},onMouseOut:e=>{e.currentTarget.style.backgroundColor=\"#dc2626\";},children:\"Try Again\"})]})});}return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",margin:\"0 auto\"},children:/*#__PURE__*/_jsx(\"div\",{style:{display:\"grid\",gridTemplateColumns:getGridColumns(),gap:\"0px\"},children:clips.map((clip,index)=>{const totalColumns=windowWidth>768?3:windowWidth>480?2:1;const currentRow=Math.floor(index/totalColumns);const currentCol=index%totalColumns;const totalRows=Math.ceil(clips.length/totalColumns);// Determine which borders this item needs\nconst needsTopBorder=currentRow===0// First row\n;const needsLeftBorder=currentCol===0// First column\n;const needsRightBorder=true// Always need right border\n;const needsBottomBorder=true// Always need bottom border\n;return /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",borderTop:needsTopBorder?\"1px solid rgba(255,255,255,0.1)\":\"none\",borderLeft:needsLeftBorder?\"1px solid rgba(255,255,255,0.1)\":\"none\",borderRight:\"1px solid rgba(255,255,255,0.1)\",borderBottom:\"1px solid rgba(255,255,255,0.1)\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:\"0px\",left:\"0px\",right:\"0px\",height:\"60px\",background:\"linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.3) 70%, transparent 100%)\",zIndex:5,pointerEvents:\"none\"}}),/*#__PURE__*/_jsx(\"p\",{style:{position:\"absolute\",top:\"12px\",left:\"12px\",width:\"80%\",color:\"white\",fontFamily:\"Montserrat, sans-serif\",zIndex:10,margin:\"0\",fontSize:\"14px\",fontWeight:\"500\",textShadow:\"0 1px 2px rgba(0,0,0,0.8)\"},children:clip.title}),/*#__PURE__*/_jsx(\"div\",{style:{aspectRatio:\"16/9\",backgroundColor:\"transparent\",overflow:\"hidden\"},children:/*#__PURE__*/_jsx(\"iframe\",{width:\"100%\",height:\"100%\",src:clip.embedded_url,frameBorder:\"0\",webkitallowfullscreen:\"true\",mozallowfullscreen:\"true\",allowFullScreen:true,scrolling:\"no\",style:{width:\"100%\",height:\"100%\"}})})]},index);})})});}SlateGrid.defaultProps={showreelId:\"482\"};addPropertyControls(SlateGrid,{showreelId:{type:ControlType.String,title:\"Showreel ID\",description:\"ID for the showreel on slateapp.com\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",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