{"version":3,"file":"ScrollingTextBar.q2spGB61.mjs","names":["useMemo"],"sources":["https:/framerusercontent.com/modules/URNL4n119Kfc05fVLjYA/98b47MVB06CpfCHtLMtn/ScrollingTextBar.js"],"sourcesContent":["// Infinite horizontally scrolling text bar to display discounts and other ongoing campaigns\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{motion}from\"framer-motion\";import{useMemo}from\"react\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ScrollingTextBar(props){const{messages,speed,backgroundColor,textColor,linkColor,font,separator,separatorSpacing,style}=props;const duration=useMemo(()=>{return 20/speed;},[speed]);// Create repeating pattern based on number of messages\nconst repeatingPattern=useMemo(()=>{if(messages.length===0)return[];// Create pattern: for n messages, repeat [0,1,2,...,n-1] many times\nconst pattern=[];const repetitions=20;for(let i=0;i<repetitions;i++){for(let msgIndex=0;msgIndex<messages.length;msgIndex++){pattern.push(messages[msgIndex]);}}return pattern;},[messages]);return /*#__PURE__*/_jsx(\"div\",{style:{...style,position:\"relative\",width:\"100%\",backgroundColor,overflow:\"hidden\",display:\"flex\",alignItems:\"center\",padding:\"12px 0\",minHeight:\"40px\"},children:/*#__PURE__*/_jsx(motion.div,{style:{display:\"flex\",alignItems:\"center\",whiteSpace:\"nowrap\",gap:separatorSpacing},animate:{x:[0,-1e3]},transition:{duration,repeat:Infinity,ease:\"linear\"},children:repeatingPattern.map((message,index)=>/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",alignItems:\"center\"},children:[/*#__PURE__*/_jsx(\"span\",{style:{color:textColor,...font},children:message.segments.map((segment,segIndex)=>{if(segment.link){return /*#__PURE__*/_jsx(\"a\",{href:segment.link,style:{color:linkColor,textDecoration:\"underline\",...font},target:\"_blank\",rel:\"noopener noreferrer\",children:segment.text},segIndex);}return /*#__PURE__*/_jsx(\"span\",{children:segment.text},segIndex);})}),separator&&/*#__PURE__*/_jsx(\"span\",{style:{color:textColor,...font,marginLeft:separatorSpacing,marginRight:separatorSpacing},children:separator})]},index))})});}addPropertyControls(ScrollingTextBar,{messages:{type:ControlType.Array,title:\"Messages\",control:{type:ControlType.Object,controls:{segments:{type:ControlType.Array,title:\"Text Segments\",control:{type:ControlType.Object,controls:{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Click here\"},link:{type:ControlType.String,title:\"Link (optional)\",defaultValue:\"\"}}},defaultValue:[{text:\"50% OFF ALL ITEMS\"}]}}},defaultValue:[{segments:[{text:\"50% OFF ALL ITEMS - \"},{text:\"SHOP NOW\",link:\"https://example.com\"}]},{segments:[{text:\"FREE SHIPPING ON ORDERS OVER $50\"}]}]},separator:{type:ControlType.String,title:\"Separator\",defaultValue:\" • \"},separatorSpacing:{type:ControlType.Number,title:\"Separator Gap\",defaultValue:0,min:0,max:100,step:1,unit:\"px\"},speed:{type:ControlType.Number,title:\"Speed\",defaultValue:1,min:.1,max:5,step:.1},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#000000\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#FFFFFF\"},linkColor:{type:ControlType.Color,title:\"Link Color\",defaultValue:\"#00BFFF\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"15px\",variant:\"Bold\",letterSpacing:\"0.05em\",lineHeight:\"1.5em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollingTextBar\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollingTextBar.map"],"mappings":"kOAIG,SAAwB,EAAiB,EAAM,CAAC,GAAK,CAAC,WAAS,QAAM,kBAAgB,YAAU,YAAU,OAAK,YAAU,m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