{"version":3,"file":"ProjectHoverImage.C0bGaUuy.mjs","names":["useState","useRef","_Fragment"],"sources":["https:/framerusercontent.com/modules/nleTDwzrNwROyJNE4JLe/g8cDGe4XatIH5mcEErD1/ProjectHoverImage.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useState,useRef,useEffect,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";// Global state to manage which component is currently showing an image\nlet globalActiveComponent=null;const globalStateListeners=new Set;let globalCurrentImage=null;function notifyGlobalStateChange(){globalStateListeners.forEach(listener=>listener());}function setGlobalActiveComponent(componentId,imageSrc){globalActiveComponent=componentId;if(componentId&&imageSrc){globalCurrentImage=imageSrc;}notifyGlobalStateChange();}/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function ProjectHoverImage(props){const{projectTitle,projectSubtitle,heroImage={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Project Hero Image\"},titleFont,subtitleFont,titleColor,subtitleColor,hoverTitleColor,hoverSubtitleColor,imageBlendAmount,animationDuration,link,subtitleXOffset}=props;const[isHovered,setIsHovered]=useState(false);const[showImage,setShowImage]=useState(false);const[currentImageSrc,setCurrentImageSrc]=useState(\"\");const[previousImageSrc,setPreviousImageSrc]=useState(\"\");const[imageLoaded,setImageLoaded]=useState(false);const[showNewImage,setShowNewImage]=useState(false);const[mousePosition,setMousePosition]=useState({x:0,y:0});const containerRef=useRef(null);const isStatic=useIsStaticRenderer();// Create a unique ID for this component instance\nconst componentId=useRef(Math.random().toString(36).substr(2,9));// Listen to global state changes\nuseEffect(()=>{const listener=()=>{const isActive=globalActiveComponent===componentId.current;startTransition(()=>{setShowImage(isActive);if(isActive&&globalCurrentImage){setCurrentImageSrc(globalCurrentImage);}});};globalStateListeners.add(listener);return()=>{globalStateListeners.delete(listener);};},[]);useEffect(()=>{if(isStatic)return;const handleMouseMove=e=>{if(typeof window!==\"undefined\"){startTransition(()=>{setMousePosition({x:e.clientX,y:e.clientY});});}};if(isHovered){window.addEventListener(\"mousemove\",handleMouseMove);}return()=>{window.removeEventListener(\"mousemove\",handleMouseMove);};},[isHovered,isStatic]);const handleMouseEnter=()=>{if(!isStatic){startTransition(()=>{setIsHovered(true);});// Set this component as the globally active one\nsetGlobalActiveComponent(componentId.current,heroImage.src);}};const handleMouseLeave=()=>{if(!isStatic){startTransition(()=>setIsHovered(false));// Don't clear the global active component - let it stay visible\n}};const handleClick=()=>{if(link&&typeof window!==\"undefined\"){window.open(link,\"_self\");}};return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{position:\"relative\",cursor:\"pointer\",zIndex:10,width:\"max-content\",minWidth:\"max-content\"},onMouseEnter:handleMouseEnter,onMouseLeave:handleMouseLeave,onClick:handleClick,children:/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:\"column\",gap:\"4px\"},children:[projectSubtitle&&/*#__PURE__*/_jsx(\"p\",{style:{margin:0,padding:0,color:isHovered?hoverSubtitleColor:subtitleColor,transition:`color ${animationDuration}ms ease-out`,width:\"max-content\",minWidth:\"max-content\",fontWeight:\"normal\",fontSize:subtitleFont.fontSize,fontFamily:subtitleFont.fontFamily,letterSpacing:subtitleFont.letterSpacing,lineHeight:subtitleFont.lineHeight,fontStyle:subtitleFont.fontStyle,transform:`translateX(${subtitleXOffset}px)`},children:projectSubtitle}),/*#__PURE__*/_jsx(\"h2\",{style:{margin:0,padding:0,color:isHovered?hoverTitleColor:titleColor,transition:`color ${animationDuration}ms ease-out`,width:\"max-content\",minWidth:\"max-content\",fontWeight:\"normal\",fontSize:titleFont.fontSize,fontFamily:titleFont.fontFamily,letterSpacing:titleFont.letterSpacing,lineHeight:titleFont.lineHeight,fontStyle:titleFont.fontStyle},children:projectTitle})]})}),!isStatic&&typeof window!==\"undefined\"&&showImage&&/*#__PURE__*/_jsxs(\"div\",{style:{position:\"fixed\",top:0,left:0,width:\"100vw\",height:\"100vh\",zIndex:1,pointerEvents:\"none\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",backgroundColor:\"#000000\"},children:[/*#__PURE__*/_jsx(\"img\",{src:currentImageSrc||heroImage.src,alt:heroImage.alt,style:{position:\"absolute\",width:\"100vw\",height:\"100vh\",objectFit:\"cover\",objectPosition:\"center\",zIndex:2,opacity:1}}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\",backgroundColor:`rgba(0, 0, 0, ${imageBlendAmount})`,mixBlendMode:\"multiply\",zIndex:1e3}})]})]});}addPropertyControls(ProjectHoverImage,{projectTitle:{type:ControlType.String,title:\"Project Title\",defaultValue:\"E-Commerce Platform\"},projectSubtitle:{type:ControlType.String,title:\"Project Subtitle\",defaultValue:\"React & Node.js\"},heroImage:{type:ControlType.ResponsiveImage,title:\"Hero Image\"},link:{type:ControlType.Link,title:\"Link\"},titleFont:{type:ControlType.Font,title:\"Title Font\",defaultValue:{fontSize:\"10px\",variant:\"Regular\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},subtitleFont:{type:ControlType.Font,title:\"Subtitle Font\",defaultValue:{fontSize:\"10px\",variant:\"Regular\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},titleColor:{type:ControlType.Color,title:\"Title Color\",defaultValue:\"#000000\"},subtitleColor:{type:ControlType.Color,title:\"Subtitle Color\",defaultValue:\"#CCCCCC\"},hoverTitleColor:{type:ControlType.Color,title:\"Hover Title Color\",defaultValue:\"#FFFFFF\"},hoverSubtitleColor:{type:ControlType.Color,title:\"Hover Subtitle Color\",defaultValue:\"#FFFFFF\"},imageBlendAmount:{type:ControlType.Number,title:\"Image Blend Amount\",defaultValue:.5,min:0,max:1,step:.1},animationDuration:{type:ControlType.Number,title:\"Animation Duration\",defaultValue:300,min:100,max:1e3,step:50,unit:\"ms\"},subtitleXOffset:{type:ControlType.Number,title:\"Subtitle X Offset\",defaultValue:0,min:-50,max:50,step:1,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ProjectHoverImage\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ProjectHoverImage.map"],"mappings":"wWAC8F,SAAS,GAAyB,CAAC,EAAqB,QAAQ,GAAU,GAAU,CAAC,CAAE,SAAS,EAAyB,EAAY,EAAS,CAAC,EAAsB,EAAe,GAAa,IAAU,EAAmB,GAAU,GAAyB,CAG5V,SAAwB,EAAkB,EAAM,CAAC,GAAK,CAAC,eAAa,kBAAgB,YAAU,CAAC,IAAI,sEAAsE,IAAI,qBAAqB,CAAC,YAAU,eAAa,aAAW,gBAAc,kBAAgB,qBAAmB,mBAAiB,oBAAkB,OAAK,mBAAiB,EAAW,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAM,CAAC,EAAgB,GAAoBA,EAAS,GAAG,CAAM,CAAC,EAAiB,GAAqBA,EAAS,GAAG,CAAM,CAAC,EAAY,GAAgBA,EAAS,GAAM,CAAM,CAAC,EAAa,GAAiBA,EAAS,GAAM,CAAM,CAAC,EAAc,GAAkBA,EAAS,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAO,EAAaC,EAAO,KAAK,CAAO,EAAS,GAAqB,CAClwB,EAAYA,EAAO,KAAK,QAAQ,CAAC,SAAS,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,CAG6B,OAF7F,MAAc,CAAC,IAAM,MAAa,CAAC,IAAM,EAAS,IAAwB,EAAY,QAAQ,MAAoB,CAAC,EAAa,EAAS,CAAI,GAAU,GAA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