{"version":3,"file":"BackButton.DoVZ0IWT.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/QTofV6KGGeskRZnPtoow/P38x2I00rtCqS562kjYR/BackButton.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{createPortal}from\"react-dom\";import{addPropertyControls,ControlType}from\"framer\";/**\n * BackButton — a frosted-glass pill (Dynamic Island style) with a smart\n * 3-step back action:\n *   1. If the page is scrolled down, smooth-scrolls to the top.\n *   2. Else if there's browser history to go back to, goes back.\n *   3. Else (landed directly, no history), goes to homeLink (\"/\").\n *\n * ── WHY THIS PORTALS TO document.body ───────────────────────────────\n * The button is position:fixed, which normally pins it to the viewport\n * regardless of where its layer sits. But two things can break that:\n *\n *   1. Any ancestor with a transform, filter, backdrop-filter or\n *      will-change becomes the containing block for fixed descendants,\n *      so the button pins to THAT element instead of the viewport.\n *   2. An ancestor with overflow: clip/hidden can clip it away\n *      entirely — which is what happens when Framer's wrapper layer\n *      ends up parked outside the page frame at a negative offset\n *      (a common artefact of inserting components programmatically).\n *\n * Portalling to document.body sidesteps both: the button is no longer\n * a descendant of anything on the page, so no wrapper position, clip\n * or transform can reach it. Its layer position on the canvas becomes\n * irrelevant — drag it anywhere, it still renders at offsetTop /\n * offsetLeft from the viewport corner.\n *\n * The portal only mounts client-side, so SSR renders nothing and there\n * is no hydration mismatch.\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function BackButton(props){const{label=\"Back\",homeLink=\"/\",scrollThreshold=80,backgroundColor=\"rgba(255,255,255,0.12)\",blurAmount=20,borderColor=\"rgba(255,255,255,0.18)\",textColor=\"#FFFFFF\",iconColor=\"#FFFFFF\",fontFamily=\"Inter\",fontWeight=600,fontSize=14,iconSize=16,cornerRadius=100,paddingX=18,paddingY=10,gap=8,shadow=true,offsetTop=20,offsetLeft=20}=props;const[mounted,setMounted]=useState(false);useEffect(()=>setMounted(true),[]);function handleClick(e){e.preventDefault();if(typeof window===\"undefined\")return;if(window.scrollY>scrollThreshold){window.scrollTo({top:0,behavior:\"smooth\"});return;}if(window.history.length>1&&document.referrer){window.history.back();return;}window.location.href=homeLink;}const button=/*#__PURE__*/_jsxs(\"button\",{onClick:handleClick,\"aria-label\":label,style:{position:\"fixed\",top:offsetTop,left:offsetLeft,zIndex:2147483e3,display:\"inline-flex\",alignItems:\"center\",gap,padding:`${paddingY}px ${paddingX}px`,borderRadius:cornerRadius,background:backgroundColor,backdropFilter:`blur(${blurAmount}px)`,WebkitBackdropFilter:`blur(${blurAmount}px)`,border:`1px solid ${borderColor}`,boxShadow:shadow?\"0 8px 24px rgba(0,0,0,0.25)\":\"none\",cursor:\"pointer\",fontFamily:`'${fontFamily}', sans-serif`,pointerEvents:\"auto\"},children:[/*#__PURE__*/_jsx(\"svg\",{width:iconSize,height:iconSize,viewBox:\"0 0 24 24\",fill:\"none\",style:{flexShrink:0},children:/*#__PURE__*/_jsx(\"path\",{d:\"M15 18l-6-6 6-6\",stroke:iconColor,strokeWidth:2,strokeLinecap:\"round\",strokeLinejoin:\"round\"})}),/*#__PURE__*/_jsx(\"span\",{style:{fontSize,fontWeight,fontFamily:`'${fontFamily}', sans-serif`,color:textColor,whiteSpace:\"nowrap\"},children:label})]});// nothing on the server; on the client it escapes to document.body\nif(!mounted||typeof document===\"undefined\")return null;return /*#__PURE__*/createPortal(button,document.body);}BackButton.displayName=\"Back Button\";addPropertyControls(BackButton,{label:{type:ControlType.String,defaultValue:\"Back\"},homeLink:{type:ControlType.String,defaultValue:\"/\",title:\"Home link\",description:\"Fallback when there's no browser history to go back to.\"},scrollThreshold:{type:ControlType.Number,defaultValue:80,min:0,max:500,title:\"Scroll threshold\",description:\"Scroll position (px) above which clicking scrolls to top instead of navigating back.\"},backgroundColor:{type:ControlType.Color,defaultValue:\"rgba(255,255,255,0.12)\",title:\"Background\"},blurAmount:{type:ControlType.Number,defaultValue:20,min:0,max:60,title:\"Blur amount\"},borderColor:{type:ControlType.Color,defaultValue:\"rgba(255,255,255,0.18)\",title:\"Border color\"},textColor:{type:ControlType.Color,defaultValue:\"#FFFFFF\",title:\"Text color\"},iconColor:{type:ControlType.Color,defaultValue:\"#FFFFFF\",title:\"Icon color\"},fontFamily:{type:ControlType.Enum,defaultValue:\"Inter\",options:[\"Inter\",\"Instrument Serif\",\"Helvetica\",\"Arial\",\"Georgia\",\"Courier New\"],title:\"Font family\"},fontWeight:{type:ControlType.Enum,defaultValue:600,options:[400,500,600,700,800],optionTitles:[\"Regular\",\"Medium\",\"Semibold\",\"Bold\",\"Extrabold\"],title:\"Font weight\"},fontSize:{type:ControlType.Number,defaultValue:14,min:10,max:28,title:\"Font size\"},iconSize:{type:ControlType.Number,defaultValue:16,min:10,max:32,title:\"Icon size\"},cornerRadius:{type:ControlType.Number,defaultValue:100,min:0,max:100,title:\"Corner radius\"},paddingX:{type:ControlType.Number,defaultValue:18,min:0,max:60,title:\"Padding X\"},paddingY:{type:ControlType.Number,defaultValue:10,min:0,max:40,title:\"Padding Y\"},gap:{type:ControlType.Number,defaultValue:8,min:0,max:40,title:\"Icon/text gap\"},shadow:{type:ControlType.Boolean,defaultValue:true,title:\"Drop shadow\"},offsetTop:{type:ControlType.Number,defaultValue:20,min:-200,max:1e3,title:\"Offset top\",description:\"Distance from the top of the viewport. The layer's position on the canvas has no effect — the button renders through a portal.\"},offsetLeft:{type:ControlType.Number,defaultValue:20,min:-200,max:1e3,title:\"Offset left\",description:\"Distance from the left of the viewport.\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"BackButton\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./BackButton.map"],"mappings":"oNA8BG,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,QAAM,OAAO,WAAS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