{"version":3,"file":"RandomProjectButton.CbfPgmgb.mjs","names":["useCallback"],"sources":["https:/framerusercontent.com/modules/hdajaPiDyYWr8bB91OjJ/eRCDMM9eMzc84myfeBNk/RandomProjectButton.js"],"sourcesContent":["// Random Project Button\n// Button that redirects to a random project URL from a configurable list when clicked\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useCallback,startTransition}from\"react\";/**\n * Random Project Button\n *\n * @framerIntrinsicWidth 260\n * @framerIntrinsicHeight 48\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight fixed\n */export default function RandomProjectButton(props){const{label,urls,background,color,font,borderRadius,style}=props;const handleClick=useCallback(()=>{if(!urls||urls.length===0)return;const idx=Math.floor(Math.random()*urls.length);let url=urls[idx].url;// Ensure leading slash for internal links\nif(url&&!/^https?:\\/+/.test(url)&&!url.startsWith(\"/\")){url=\"/\"+url.replace(/^\\/+/,\"\");}if(typeof window!==\"undefined\"&&url){startTransition(()=>{window.location.href=url;});}},[urls]);return /*#__PURE__*/_jsx(\"button\",{type:\"button\",style:{...style,width:\"100%\",height:48,background,color,border:\"none\",borderRadius,cursor:\"pointer\",transition:\"background 0.15s\",...font,font:undefined,fontFamily:font.fontFamily,fontSize:font.fontSize,fontWeight:font.fontWeight,letterSpacing:font.letterSpacing,lineHeight:font.lineHeight,fontStyle:font.fontStyle,outline:\"none\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",minWidth:0,minHeight:0},\"aria-label\":label,onClick:handleClick,onMouseEnter:e=>e.currentTarget.querySelector(\"span\").style.textDecoration=\"none\",onMouseLeave:e=>e.currentTarget.querySelector(\"span\").style.textDecoration=\"underline\",children:/*#__PURE__*/_jsx(\"span\",{style:{width:\"max-content\",textDecoration:\"underline\",display:\"inline-block\",lineHeight:1,paddingBottom:0,marginBottom:0},children:label})});}addPropertyControls(RandomProjectButton,{label:{type:ControlType.String,title:\"Label\",defaultValue:\"Discover a random project\"},urls:{type:ControlType.Array,title:\"Project URLs\",control:{type:ControlType.Object,controls:{url:{type:ControlType.String,title:\"URL\",placeholder:\"/project1\",defaultValue:\"/project1\"},label:{type:ControlType.String,title:\"Label\",placeholder:\"Project 1\",defaultValue:\"Project 1\"}}},defaultValue:[{url:\"/project1\",label:\"Project 1\"},{url:\"/project2\",label:\"Project 2\"},{url:\"/project3\",label:\"Project 3\"}]},background:{type:ControlType.Color,title:\"Background\",defaultValue:\"#111\"},color:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#fff\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"16px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"}},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:8,min:0,max:32}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RandomProjectButton\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"48\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerIntrinsicWidth\":\"260\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./RandomProjectButton.map"],"mappings":"iTAUG,SAAwB,EAAoB,EAAM,CAAC,GAAK,CAAC,QAAM,OAAK,aAAW,QAAM,OAAK,eAAa,SAAO,EAAY,EAAYA,MAAgB,CAAC,GAAG,CAAC,GAAM,EAAK,SAAS,EAAE,OAAO,IAAM,EAAI,KAAK,MAAM,KAAK,QAAQ,CAAC,EAAK,OAAO,CAAK,EAAI,EAAK,GAAK,IAC1P,GAAK,CAAC,cAAc,KAAK,EAAI,EAAE,CAAC,EAAI,WAAW,IAAI,GAAE,EAAI,IAAI,EAAI,QAAQ,OAAO,GAAG,EAAY,IAAS,QAAa,GAAK,MAAoB,CAAC,EAAO,SAAS,KAAK,GAAM,EAAI,CA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