{"version":3,"file":"Substack.adDX8Ppu.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/BxSQdJgyAJEjfa7Ua9Kr/ChX8OqoM5AWGx17bCX2v/Substack.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState,useEffect}from\"react\";import{motion}from\"framer-motion\";export default function SubstackGrid(props){const{substackUrl,accentColor,itemCount,columns}=props;const[posts,setPosts]=useState([]);const[loading,setLoading]=useState(true);useEffect(()=>{const cleanUrl=substackUrl.replace(/\\/$/,\"\");// Appended Date.now() as a cache-buster during your Framer previewing sessions\nfetch(`https://api.rss2json.com/v1/api.json?rss_url=${cleanUrl}/feed&t=${Date.now()}`).then(res=>res.json()).then(data=>{if(data.items)setPosts(data.items.slice(0,itemCount));setLoading(false);});},[substackUrl,itemCount]);// Helper to strip HTML and get a clean snippet\nconst getSnippet=html=>{const doc=new Array(...new DOMParser().parseFromString(html,\"text/html\").body.childNodes);const text=doc.map(n=>n.textContent).join(\" \");return text.length>140?text.substring(0,140)+\"...\":text;};// Helper to find body images if Substack omitted the feature image metadata\nconst getPostImage=post=>{if(post.thumbnail)return post.thumbnail;if(post.enclosure&&post.enclosure.link)return post.enclosure.link;try{const htmlContent=post.content||post.description;if(!htmlContent)return\"\";const doc=new DOMParser().parseFromString(htmlContent,\"text/html\");const firstImg=doc.querySelector(\"img\");return firstImg?firstImg.src:\"\";}catch(e){return\"\";}};return /*#__PURE__*/_jsx(\"div\",{style:{...gridContainer,gridTemplateColumns:`repeat(${columns}, 1fr)`},children:loading?/*#__PURE__*/_jsx(\"p\",{style:{color:\"white\"},children:\"Loading...\"}):posts.map((post,i)=>{const fallbackImage=getPostImage(post)||\"https://via.placeholder.com/400x200?text=No+Image\";return /*#__PURE__*/_jsxs(motion.a,{href:post.link,target:\"_blank\",whileHover:{y:-8},style:cardStyle,children:[/*#__PURE__*/_jsx(\"div\",{style:{...imageContainer,backgroundImage:`url(${fallbackImage})`},children:/*#__PURE__*/_jsx(\"div\",{style:{...categoryTag,backgroundColor:accentColor},children:\"Article\"})}),/*#__PURE__*/_jsxs(\"div\",{style:contentStyle,children:[/*#__PURE__*/_jsx(\"h3\",{style:titleStyle,children:post.title}),/*#__PURE__*/_jsx(\"p\",{style:snippetStyle,children:getSnippet(post.description)}),/*#__PURE__*/_jsxs(\"div\",{style:footerStyle,children:[/*#__PURE__*/_jsx(\"span\",{style:dateStyle,children:new Date(post.pubDate).toLocaleDateString()}),/*#__PURE__*/_jsx(\"span\",{style:{color:accentColor,fontWeight:\"600\"},children:\"Read More →\"})]})]})]},i);})});}// --- STYLES ---\nconst gridContainer={display:\"grid\",gap:\"24px\",width:\"100%\",padding:\"20px\"};const cardStyle={display:\"flex\",flexDirection:\"column\",textDecoration:\"none\",color:\"inherit\",backgroundColor:\"#1A1A1A\",borderRadius:\"20px\",overflow:\"hidden\",border:\"1px solid rgba(255,255,255,0.1)\"};const imageContainer={width:\"100%\",height:\"220px\",backgroundSize:\"cover\",backgroundPosition:\"center\",position:\"relative\"};const categoryTag={position:\"absolute\",bottom:\"12px\",left:\"12px\",padding:\"4px 12px\",borderRadius:\"8px\",fontSize:\"12px\",fontWeight:\"700\",color:\"#000\"};const contentStyle={padding:\"24px\",display:\"flex\",flexDirection:\"column\",flex:1};const titleStyle={fontSize:\"22px\",fontWeight:\"700\",margin:\"0 0 12px 0\",color:\"#FFF\",lineHeight:1.3};const snippetStyle={fontSize:\"15px\",lineHeight:\"1.6\",opacity:.7,color:\"#CCC\",marginBottom:\"20px\",flex:1};const footerStyle={display:\"flex\",justifyContent:\"space-between\",alignItems:\"center\",fontSize:\"13px\"};const dateStyle={opacity:.5,color:\"#FFF\"};addPropertyControls(SubstackGrid,{substackUrl:{type:ControlType.String,defaultValue:\"https://jeremyjo.substack.com\"},accentColor:{type:ControlType.Color,defaultValue:\"#1BECFF\"},itemCount:{type:ControlType.Number,defaultValue:3,min:1,max:9},columns:{title:\"Columns (Desktop)\",type:ControlType.Number,defaultValue:3,min:1,max:4}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SubstackGrid\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Substack.map"],"mappings":"yOAAqL,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,cAAY,cAAY,YAAU,WAAS,EAAW,CAAC,EAAM,GAAUA,EAAS,EAAE,CAAC,CAAM,CAAC,EAAQ,GAAYA,EAAS,GAAK,CAAC,MAAc,CAAC,IAAM,EAAS,EAAY,QAAQ,MAAM,GAAG,CAC/Z,MAAM,gDAAgD,EAAS,UAAU,KAAK,KAAK,GAAG,CAAC,KAAK,GAAK,EAAI,MAAM,CAAC,CAAC,KAAK,GAAM,CAAI,EAAK,OAAM,EAAS,EAAK,MAAM,MAAM,EAAE,EAAU,CAAC,CAAC,EAAW,GAAM,EAAG,EAAG,CAAC,EAAY,EAAU,CAAC,CAC9N,IAAM,EAAW,GAAM,CAA2F,IAAM,EAAtF,IAAI,MAAM,GAAG,IAAI,WAAW,CAAC,gBAAgB,EAAK,YAAY,CAAC,KAAK,WAAW,CAAgB,IAAI,GAAG,EAAE,YAAY,CAAC,KAAK,IAAI,CAAC,OAAO,EAAK,OAAO,IAAI,EAAK,UAAU,EAAE,IAAI,CAAC,MAAM,GAC9M,EAAa,GAAM,CAAC,GAAG,EAAK,UAAU,OAAO,EAAK,UAAU,GAAG,EAAK,WAAW,EAAK,UAAU,KAAK,OAAO,EAAK,UAAU,KAAK,GAAG,CAAC,IAAM,EAAY,EAAK,SAAS,EAAK,YAAY,GAAG,CAAC,EAAY,MAAM,GAAsE,IAAM,EAA/D,IAAI,WAAW,CAAC,gBAAgB,EAAY,YAAY,CAAoB,cAAc,MAAM,CAAC,OAAO,EAAS,EAAS,IAAI,QAAY,CAAC,MAAM,KAAM,OAAoB,EAAK,MAAM,C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