{"version":3,"file":"TestSlate.B_9KNqWN.mjs","names":["useState"],"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\",\"name\":\"SlateGrid\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TestSlate.map"],"mappings":"sMAIyC,SAAwB,EAAU,EAAM,CAAC,GAAK,CAAC,EAAM,GAAUA,EAAS,CAAC,CAAC,EAAO,CAAC,EAAQ,GAAYA,EAAS,EAAI,EAAO,C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