{"version":3,"file":"Countdown.07cNimx3.mjs","names":["React.useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/MnaxtwtnbKRlyL7k0DMp/AgdLqXmqrP80IwjPZ4wK/Countdown.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";export function Countdown(props){const{targetDate,targetTime,fontSize,fontColor,fontFamily,fontWeight,gapSize,labels}=props;const countdownStyles={fontSize:fontSize,fontFamily:fontFamily,fontWeight:fontWeight,color:fontColor,display:\"flex\",justifyContent:\"flex-start\",alignItems:\"center\",whiteSpace:\"pre\"};const gapStyles={marginLeft:gapSize};const[timeLeft,setTimeLeft]=React.useState(getTimeLeft());React.useEffect(()=>{const intervalId=setInterval(()=>{setTimeLeft(getTimeLeft());},1e3);return()=>{clearInterval(intervalId);};},[targetDate]);function getTimeLeft(){const now=new Date().getTime();const targetDateTime=new Date(`${targetDate}T${targetTime}`).getTime();const timeDifference=targetDateTime-now;if(timeDifference<0){return{days:0,hours:0,minutes:0,seconds:0};}const days=Math.floor(timeDifference/(1e3*60*60*24));const hours=Math.floor(timeDifference%(1e3*60*60*24)/(1e3*60*60));const minutes=Math.floor(timeDifference%(1e3*60*60)/(1e3*60));const seconds=Math.floor(timeDifference%(1e3*60)/1e3);return{days,hours,minutes,seconds};}return /*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\"},children:[timeLeft.days>0&&/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsxs(\"div\",{style:countdownStyles,children:[timeLeft.days,/*#__PURE__*/_jsx(\"span\",{style:countdownStyles,children:labels.days})]}),/*#__PURE__*/_jsx(\"div\",{style:gapStyles})]}),timeLeft.hours>0&&/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsxs(\"div\",{style:countdownStyles,children:[timeLeft.hours,/*#__PURE__*/_jsx(\"span\",{style:countdownStyles,children:labels.hours})]}),/*#__PURE__*/_jsx(\"div\",{style:gapStyles})]}),timeLeft.minutes>0&&/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsxs(\"div\",{style:countdownStyles,children:[timeLeft.minutes,/*#__PURE__*/_jsx(\"span\",{style:countdownStyles,children:labels.minutes})]}),/*#__PURE__*/_jsx(\"div\",{style:gapStyles})]}),/*#__PURE__*/_jsxs(\"div\",{style:countdownStyles,children:[timeLeft.seconds,/*#__PURE__*/_jsx(\"span\",{style:countdownStyles,children:labels.seconds})]})]});}Countdown.defaultProps={targetDate:\"2023-12-31\",targetTime:\"23:59:59\",fontSize:40,fontColor:\"#707070\",fontFamily:\"DM Sans\",fontWeight:\"400\",gapSize:16,labels:{days:\"Days\",hours:\"Hours\",minutes:\"Minutes\",seconds:\"Seconds\"}};addPropertyControls(Countdown,{targetDate:{title:\"Target Date\",type:ControlType.String,defaultValue:\"2023-12-31\"},targetTime:{title:\"Target Time\",type:ControlType.String,defaultValue:\"23:59:59\"},fontSize:{title:\"Font Size\",type:ControlType.Number,min:8,max:200,step:1},fontColor:{title:\"Font Color\",type:ControlType.Color},fontFamily:{title:\"Font Family\",type:ControlType.String},fontWeight:{title:\"Font Weight\",type:ControlType.Enum,options:[\"100\",\"300\",\"400\",\"500\",\"700\"],optionTitles:[\"Light\",\"Regular\",\"Medium\",\"Semibold\",\"Bold\"],defaultValue:\"400\"},gapSize:{title:\"Gap Size\",type:ControlType.Number,min:0,max:200,step:1},labels:{title:\"Labels\",type:ControlType.Object,controls:{days:{type:ControlType.String,title:\"Days\"},hours:{type:ControlType.String,title:\"Hours\"},minutes:{type:ControlType.String,title:\"Minutes\"},seconds:{type:ControlType.String,title:\"Seconds\"}}}});\nexport const __FramerMetadata__ = {\"exports\":{\"Countdown\":{\"type\":\"reactComponent\",\"name\":\"Countdown\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Countdown.map"],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