{"version":3,"file":"ScrollButton.PGo_OMlF.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/2mFcpN9IRfzsJf7ZjZ9N/WfTfVARjKZl36wYKEQen/ScrollButton.js"],"sourcesContent":["// Scroll to top/bottom round button that appears when scrolling\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState,startTransition}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{motion,AnimatePresence}from\"framer-motion\";/**\n * Scroll to Top/Bottom Button\n *\n * @framerIntrinsicWidth 60\n * @framerIntrinsicHeight 60\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function ScrollButton(props){const{direction=\"up\",backgroundColor=\"#000000\",iconColor=\"#FFFFFF\",size=60,showThreshold=300,position=\"right\",offset=20,style}=props;const[isVisible,setIsVisible]=useState(false);const[responsiveSize,setResponsiveSize]=useState(size);const[responsiveOffset,setResponsiveOffset]=useState(offset);useEffect(()=>{if(typeof window===\"undefined\"||RenderTarget.current()===RenderTarget.thumbnail)return;const updateResponsiveSizes=()=>{const width=window.innerWidth;// Adjust size based on screen width\nlet newSize=size;let newOffset=offset;if(width<480){// Mobile: reduce to 70% of original size\nnewSize=size*.7;newOffset=offset*.7;}else if(width<768){// Tablet: reduce to 85% of original size\nnewSize=size*.85;newOffset=offset*.85;}// Desktop and larger: use original size\nstartTransition(()=>{setResponsiveSize(newSize);setResponsiveOffset(newOffset);});};updateResponsiveSizes();window.addEventListener(\"resize\",updateResponsiveSizes);return()=>window.removeEventListener(\"resize\",updateResponsiveSizes);},[size,offset]);useEffect(()=>{if(typeof window===\"undefined\"||RenderTarget.current()===RenderTarget.thumbnail)return;const handleScroll=()=>{const scrollTop=window.scrollY;const scrollHeight=document.documentElement.scrollHeight;const clientHeight=window.innerHeight;if(direction===\"up\"){startTransition(()=>setIsVisible(scrollTop>showThreshold));}else{const isAtBottom=scrollTop+clientHeight>=scrollHeight-showThreshold;startTransition(()=>setIsVisible(!isAtBottom&&scrollTop>100));}};window.addEventListener(\"scroll\",handleScroll);handleScroll();return()=>window.removeEventListener(\"scroll\",handleScroll);},[direction,showThreshold]);const handleClick=()=>{if(typeof window===\"undefined\")return;if(direction===\"up\"){window.scrollTo({top:0,behavior:\"smooth\"});}else{window.scrollTo({top:document.documentElement.scrollHeight,behavior:\"smooth\"});}};return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",width:\"100%\",height:\"100%\",pointerEvents:\"none\"},children:/*#__PURE__*/_jsx(AnimatePresence,{children:isVisible&&/*#__PURE__*/_jsx(motion.button,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.2},onClick:handleClick,style:{position:\"absolute\",bottom:responsiveOffset,[position]:responsiveOffset,width:responsiveSize,height:responsiveSize,borderRadius:\"50%\",backgroundColor,border:\"none\",cursor:\"pointer\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",boxShadow:\"0 4px 12px rgba(0, 0, 0, 0.15)\",pointerEvents:\"auto\"},whileHover:{scale:1.1},whileTap:{scale:.95},\"aria-label\":direction===\"up\"?\"Scroll to top\":\"Scroll to bottom\",children:/*#__PURE__*/_jsx(\"svg\",{width:responsiveSize*.4,height:responsiveSize*.4,viewBox:\"0 0 24 24\",fill:\"none\",stroke:iconColor,strokeWidth:\"2.5\",strokeLinecap:\"round\",strokeLinejoin:\"round\",style:{transform:direction===\"up\"?\"rotate(0deg)\":\"rotate(180deg)\"},children:/*#__PURE__*/_jsx(\"polyline\",{points:\"18 15 12 9 6 15\"})})})})});}addPropertyControls(ScrollButton,{direction:{type:ControlType.Enum,title:\"Direction\",options:[\"up\",\"down\"],optionTitles:[\"Scroll Up\",\"Scroll Down\"],defaultValue:\"up\",displaySegmentedControl:true},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#000000\"},iconColor:{type:ControlType.Color,title:\"Icon Color\",defaultValue:\"#FFFFFF\"},size:{type:ControlType.Number,title:\"Size\",defaultValue:60,min:40,max:100,step:5,unit:\"px\"},showThreshold:{type:ControlType.Number,title:\"Show After\",defaultValue:300,min:0,max:1e3,step:50,unit:\"px\"},position:{type:ControlType.Enum,title:\"Position\",options:[\"left\",\"right\"],optionTitles:[\"Left\",\"Right\"],defaultValue:\"right\",displaySegmentedControl:true},offset:{type:ControlType.Number,title:\"Offset\",defaultValue:20,min:10,max:100,step:5,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerIntrinsicHeight\":\"60\",\"framerSupportedLayoutWidth\":\"auto\",\"framerIntrinsicWidth\":\"60\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollButton.map"],"mappings":"gbASG,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,YAAU,KAAK,kBAAgB,UAAU,YAAU,UAAU,OAAK,GAAG,gBAAc,IAAI,WAAS,QAAQ,SAAO,GAAG,SAAO,EAAW,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAM,CAAC,EAAe,GAAmBA,EAAS,EAAK,CAAM,CAAC,EAAiB,GAAqBA,EAAS,EAAO,CAIwuB,OAJvuB,MAAc,CAAC,GAAU,IAAS,QAAa,EAAa,SAAS,GAAG,EAAa,UAAU,OAAO,IAAM,MAA0B,CAAC,IAAM,EAAM,EAAO,WAC5e,EAAQ,EAAS,EAAU,EAAU,EAAM,KAC/C,EAAQ,EAAK,GAAG,EAAU,EAAO,IAAY,EAAM,MACnD,EAAQ,EAAK,IAAI,EAAU,EAAO,KAClC,MAAoB,CAAC,EAAkB,EAAQ,CAAC,EAAoB,EAAU,EAAG,EAAmF,OAAhF,GAAuB,CAAC,EAAO,iBAAiB,SAAS,EAAsB,KAAW,EAAO,oBAAoB,SAAS,EAAsB,EAAG,CAAC,EAAK,EAAO,CAAC,CAAC,MAAc,CA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