{"version":3,"file":"rollingLink.D4ZvQfI3.mjs","names":["useState","useMemo"],"sources":["https:/framerusercontent.com/modules/hdoIy3cmddPjrfrwcb72/PrE5HZ1LgsKlfDlwdGt7/rollingLink.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{motion,useAnimation}from\"framer-motion\";import{useState,useMemo,useEffect}from\"react\";/**\n *\n * @framerIntrinsicWidth 32\n * @framerIntrinsicHeight 20\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function RollingLink(props){const{font,style,text,color,height,animationDuration}=props;const[isHovered,setIsHovered]=useState(false);const controls=useAnimation();const fontSize=parseInt(font.fontSize,10);const moveUpDistance=fontSize*1.25;const topDistance=fontSize*1.25;const words=useMemo(()=>{return text.split(\" \").map((word,i)=>({word,i}));},[text]);useEffect(()=>{if(isHovered){controls.start({y:-moveUpDistance,transition:{duration:animationDuration,ease:\"easeOut\"}});}else{controls.start({y:0,transition:{duration:animationDuration*.5,ease:\"easeOut\"}});}},[isHovered,controls,animationDuration]);return /*#__PURE__*/_jsx(motion.div,{onMouseEnter:()=>setIsHovered(true),onMouseLeave:()=>setIsHovered(false),style:{...style,display:\"inline-flex\",cursor:\"pointer\",textDecoration:\"none\",overflow:\"hidden\",...font},children:words.map(({word,i})=>/*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",overflow:\"hidden\",height:\"1.2\",marginRight:i<words.length?\"0.25em\":\"0px\"},children:[/*#__PURE__*/_jsx(motion.span,{animate:controls,style:{display:\"block\",color:color},children:word}),/*#__PURE__*/_jsx(motion.span,{animate:controls,style:{position:\"absolute\",top:topDistance,left:0,display:\"block\",color:color},initial:{y:0},children:word})]}))});}addPropertyControls(RollingLink,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Link\"},font:{type:ControlType.Font,title:\"Font\",defaultValue:{fontSize:\"16px\",variant:\"Regular\",letterSpacing:\"-0.02em\",lineHeight:\"1.2em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},color:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#121212\"},height:{type:ControlType.Number,title:\"Height\",defaultValue:1.2,min:1,max:4,step:.1,unit:\"em\"},animationDuration:{type:ControlType.Number,title:\"Animation Duration\",defaultValue:.3,min:.1,max:1,step:.1,unit:\"s\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RollingLink\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"20\",\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"32\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./rollingLink.map"],"mappings":"uPAOG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,OAAK,QAAM,OAAK,QAAM,SAAO,qBAAmB,EAAW,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAO,EAAS,GAAc,CAAO,EAAS,SAAS,EAAK,SAAS,GAAG,CAAO,EAAe,EAAS,KAAW,EAAY,EAAS,KAAW,EAAMC,MAAoB,EAAK,MAAM,IAAI,CAAC,KAAK,EAAK,KAAK,CAAC,OAAK,IAAE,EAAE,CAAG,CAAC,EAAK,CAAC,CAA0P,OAAzP,MAAc,CAAI,EAAW,EAAS,MAAM,CAAC,EAAE,CAAC,EAAe,WAAW,CAAC,SAAS,EAAkB,KAAK,UAAU,CAAC,CAAC,CAAO,EAAS,MAAM,CAAC,EAAE,EAAE,WAAW,CAAC,SAAS,EAAkB,GAAG,KAAK,UAAU,CAAC,CAAC,EAAI,CAAC,EAAU,EAAS,EAAkB,CAAC,CAAqB,EAAK,EAAO,IAAI,CAAC,iBAAiB,EAAa,GAAK,CAAC,iBAAiB,EAAa,GAAM,CAAC,MAAM,CAAC,GAAG,EAAM,QAAQ,c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