{"version":3,"file":"ParallaxImage.C9WSdFP6.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/rjLkrpbqSprsJ0QumFfd/vlZ4J7axc3lUqBAu9RZN/ParallaxImage.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useRef}from\"react\";import{motion,useScroll,useTransform}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";function ParallaxImage({imageFile,imageUrl,parallaxAmount}){const ref=useRef(null);const{scrollYProgress}=useScroll({target:ref,offset:[\"start end\",\"end start\"]});const y=useTransform(scrollYProgress,[0,1],[-parallaxAmount,parallaxAmount]);const getFileUrl=file=>typeof file===\"string\"?file:file?.url??\"\";const src=getFileUrl(imageFile)||imageUrl;const hasMedia=Boolean(src);return /*#__PURE__*/_jsx(\"div\",{ref:ref,style:{width:\"100%\",height:\"100%\",overflow:\"hidden\",position:\"relative\",backgroundColor:!hasMedia?\"#eee\":undefined,display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:hasMedia?/*#__PURE__*/_jsx(motion.div,{style:{y,position:\"absolute\",top:`$-{parallaxAmount}px`,left:0,right:0,height:`calc(100% + ${parallaxAmount*2}px)`},children:/*#__PURE__*/_jsx(\"img\",{src:src,alt:\"Parallax\",style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",display:\"block\"}})}):/*#__PURE__*/_jsx(\"span\",{style:{color:\"#aaa\",fontSize:12},children:\"No image selected\"})});}addPropertyControls(ParallaxImage,{imageFile:{type:ControlType.File,allowedFileTypes:[\"jpg\",\"jpeg\",\"png\",\"gif\",\"webp\"],title:\"Image File\"},imageUrl:{type:ControlType.String,title:\"Image URL\"},parallaxAmount:{type:ControlType.Number,title:\"Parallax\",min:0,max:200,step:5,defaultValue:50}});export default ParallaxImage;\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ParallaxImage\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\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