{"version":3,"file":"SmoothScrollNav.Cb5foKKq.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/ttTHM6QDveaI2Jqtawbj/DLEFMf7yyPbhkLJ9j1z8/SmoothScrollNav.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useRef}from\"react\";// Module-level registry: AnchorMarker registers its ref here on mount.\nconst anchorRegistry=new Map;/** Passthrough override kept for backwards compatibility. */export const withSmoothScroll=Component=>{return props=>/*#__PURE__*/_jsx(Component,{...props});};/**\n * AnchorMarker — place at the TOP of each page section.\n * Sets an HTML id and registers in anchorRegistry for NavAnchor lookup.\n */export function AnchorMarker({anchorId}){const ref=useRef(null);useEffect(()=>{if(ref.current)anchorRegistry.set(anchorId,ref.current);return()=>{anchorRegistry.delete(anchorId);};},[anchorId]);return /*#__PURE__*/_jsx(\"div\",{ref:ref,id:anchorId,style:{display:\"block\",height:\"0px\",// offset so the fixed nav doesn't cover the section header\nscrollMarginTop:\"100px\"}});}addPropertyControls(AnchorMarker,{anchorId:{type:ControlType.String,title:\"Anchor ID\",defaultValue:\"section\",placeholder:\"e.g. projects\"}});/**\n * NavAnchor — nav item that smooth-scrolls to a page section.\n * Uses scrollIntoView which auto-detects Framer's scroll container.\n * If the anchor isn't found on the current page, navigates to fallbackUrl.\n */export function NavAnchor({anchorId,label,fallbackUrl=\"/\"}){const handleClick=e=>{e.preventDefault();e.stopPropagation();// Try registry first (from AnchorMarker component), then DOM fallback\n// (for plain <div id=\"...\"> anchors in code components like HomeSections)\nconst el=anchorRegistry.get(anchorId)??document.getElementById(anchorId);if(el){// scrollIntoView auto-detects the scrollable container — works in\n// both Framer preview (overflow:auto wrapper div) and published site\nel.scrollIntoView({behavior:\"smooth\",block:\"start\"});}else if(fallbackUrl){// Anchor not on this page — navigate to fallback URL\nwindow.location.href=fallbackUrl;}};return /*#__PURE__*/_jsx(\"button\",{onClick:handleClick,style:{fontFamily:\"Inter, sans-serif\",fontWeight:500,fontSize:\"15px\",lineHeight:\"1.5em\",letterSpacing:\"-0.01em\",color:\"rgb(17, 16, 17)\",padding:\"4px 8px\",display:\"inline-flex\",alignItems:\"center\",cursor:\"pointer\",whiteSpace:\"nowrap\",background:\"none\",border:\"none\",outline:\"none\"},children:label});}addPropertyControls(NavAnchor,{anchorId:{type:ControlType.String,title:\"Anchor ID\",defaultValue:\"section\",placeholder:\"e.g. projects\"},label:{type:ControlType.String,title:\"Label\",defaultValue:\"Nav Item\"},fallbackUrl:{type:ControlType.String,title:\"Fallback URL\",defaultValue:\"/\",placeholder:\"e.g. /build-lab or /\"}});/**\n * ContactButton — pill-shaped CTA button that smooth-scrolls to an anchor.\n * Styled to match the portfolio's dark \"Contact me\" button.\n * Falls back to navigating to fallbackUrl if the anchor isn't on the page.\n */export function ContactButton({anchorId=\"contact\",label=\"Contact me\",fallbackUrl=\"/\",textColor=\"rgb(255, 255, 255)\",bgColor=\"rgb(17, 16, 17)\"}){const handleClick=e=>{e.preventDefault();e.stopPropagation();const el=anchorRegistry.get(anchorId)??document.getElementById(anchorId);if(el){el.scrollIntoView({behavior:\"smooth\",block:\"start\"});}else if(fallbackUrl){window.location.href=fallbackUrl;}};return /*#__PURE__*/_jsx(\"button\",{onClick:handleClick,style:{fontFamily:\"Inter, sans-serif\",fontWeight:500,fontSize:\"15px\",lineHeight:\"1.5em\",letterSpacing:\"-0.01em\",color:textColor,backgroundColor:bgColor,padding:\"12px 24px\",borderRadius:\"100px\",display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",cursor:\"pointer\",whiteSpace:\"nowrap\",border:\"none\",outline:\"none\"},children:label});}addPropertyControls(ContactButton,{anchorId:{type:ControlType.String,title:\"Anchor ID\",defaultValue:\"contact\"},label:{type:ControlType.String,title:\"Label\",defaultValue:\"Contact me\"},fallbackUrl:{type:ControlType.String,title:\"Fallback URL\",defaultValue:\"/\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"rgb(255, 255, 255)\"},bgColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"rgb(17, 16, 17)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"AnchorMarker\":{\"type\":\"reactComponent\",\"name\":\"AnchorMarker\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"ContactButton\":{\"type\":\"reactComponent\",\"name\":\"ContactButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSmoothScroll\":{\"type\":\"reactHoc\",\"name\":\"withSmoothScroll\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"NavAnchor\":{\"type\":\"reactComponent\",\"name\":\"NavAnchor\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SmoothScrollNav.map"],"mappings":"0LAIG,SAAgB,EAAa,CAAC,YAAU,CAAC,IAAM,EAAIA,EAAO,KAAK,CAAmI,OAAlI,OAAkB,EAAI,SAAQ,EAAe,IAAI,EAAS,EAAI,QAAQ,KAAW,CAAC,EAAe,OAAO,EAAS,GAAK,CAAC,EAAS,CAAC,CAAqB,EAAK,MAAM,CAAK,MAAI,GAAG,EAAS,MAAM,CAAC,QAAQ,QAAQ,OAAO,MACvR,gBAAgB,QAAQ,CAAC,CAAC,CAIvB,SAAgB,EAAU,CAAC,WAAS,QAAM,cAAY,KAAK,CAK1B,OAAoB,EAAK,SAAS,CAAC,QALU,GAAG,CAAC,EAAE,gBAAgB,CAAC,EAAE,iBAAiB,CAE3H,IAAM,EAAG,EAAe,IAAI,EAAS,EAAE,SAAS,eAAe,EAAS,CAAI,EAE5E,EAAG,eAAe,CAAC,SAAS,SAAS,MAAM,QAAQ,CAAC,CAAU,IAC9D,EAAO,SAAS,KAAK,IAAsE,MAAM,CAAC,WAAW,oBAAoB,WAAW,IAAI,SAAS,OAAO,WAAW,QAAQ,cAAc,UAAU,MAAM,kBAAkB,QAAQ,UAAU,QAAQ,cAAc,WAA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