Compare commits
	
		
			2 Commits 
		
	
	
		
			172d1ea64e
			...
			3a5087bdc8
		
	
	| Author | SHA1 | Date | 
|---|---|---|
|  | 3a5087bdc8 | |
|  | 2919595115 | 
|  | @ -9066,6 +9066,14 @@ | ||||||
|         "prop-types": "15.5.10" |         "prop-types": "15.5.10" | ||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|  |     "react-fontawesome": { | ||||||
|  |       "version": "1.6.1", | ||||||
|  |       "resolved": "https://registry.npmjs.org/react-fontawesome/-/react-fontawesome-1.6.1.tgz", | ||||||
|  |       "integrity": "sha1-7dzhfn3HMaoJ/UoYZoimF5OhbFw=", | ||||||
|  |       "requires": { | ||||||
|  |         "prop-types": "15.5.10" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|     "react-helmet": { |     "react-helmet": { | ||||||
|       "version": "5.1.3", |       "version": "5.1.3", | ||||||
|       "resolved": "https://registry.npmjs.org/react-helmet/-/react-helmet-5.1.3.tgz", |       "resolved": "https://registry.npmjs.org/react-helmet/-/react-helmet-5.1.3.tgz", | ||||||
|  | @ -11081,6 +11089,11 @@ | ||||||
|         "minimalistic-assert": "1.0.0" |         "minimalistic-assert": "1.0.0" | ||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|  |     "webfontloader": { | ||||||
|  |       "version": "1.6.28", | ||||||
|  |       "resolved": "https://registry.npmjs.org/webfontloader/-/webfontloader-1.6.28.tgz", | ||||||
|  |       "integrity": "sha1-23hhKSU8tujq5UwvsF+HCvZnW64=" | ||||||
|  |     }, | ||||||
|     "webpack": { |     "webpack": { | ||||||
|       "version": "3.4.1", |       "version": "3.4.1", | ||||||
|       "resolved": "https://registry.npmjs.org/webpack/-/webpack-3.4.1.tgz", |       "resolved": "https://registry.npmjs.org/webpack/-/webpack-3.4.1.tgz", | ||||||
|  |  | ||||||
|  | @ -24,7 +24,7 @@ export default class Countdown extends React.Component { | ||||||
| 
 | 
 | ||||||
|   componentDidMount() { |   componentDidMount() { | ||||||
|     this.tick(); |     this.tick(); | ||||||
|     this.interval = setInterval(this.tick.bind(this), 1000); |     this.interval = setInterval(this.tick.bind(this), 100); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   componentWillUnmount() { |   componentWillUnmount() { | ||||||
|  | @ -49,10 +49,13 @@ export default class Countdown extends React.Component { | ||||||
| 
 | 
 | ||||||
|     const durationMoment = moment.duration(duration); |     const durationMoment = moment.duration(duration); | ||||||
| 
 | 
 | ||||||
|     const days = durationMoment.days(); |     const milliseconds = durationMoment.asMilliseconds(); | ||||||
|     const hours = durationMoment.hours(); |     const seconds = (milliseconds / 1000) % 60; | ||||||
|     const minutes = durationMoment.minutes(); |     const minutes = (milliseconds / (60 * 1000)) % 60; | ||||||
|     const seconds = durationMoment.seconds(); |     const hours = (milliseconds / (60 * 60 * 1000)) % 24; | ||||||
|  |     const days = (milliseconds / (24 * 60 * 60 * 1000)); | ||||||
|  | 
 | ||||||
|  |     console.log({ days, hours, minutes, seconds }); | ||||||
| 
 | 
 | ||||||
|     const size = 160; // @HACK |     const size = 160; // @HACK | ||||||
| 
 | 
 | ||||||
|  | @ -61,7 +64,7 @@ export default class Countdown extends React.Component { | ||||||
|       <div className={style.countdown}> |       <div className={style.countdown}> | ||||||
|         <ProgressCircle size={size} max={3} progress={days} stroke="rgb(76,114,163)"> |         <ProgressCircle size={size} max={3} progress={days} stroke="rgb(76,114,163)"> | ||||||
|           <DigitBlock suffix="d"> |           <DigitBlock suffix="d"> | ||||||
|             {days.toLocaleString(locale, { |             {Math.floor(days).toLocaleString(locale, { | ||||||
|               minimumIntegerDigits, |               minimumIntegerDigits, | ||||||
|               useGrouping, |               useGrouping, | ||||||
|             })} |             })} | ||||||
|  | @ -69,7 +72,7 @@ export default class Countdown extends React.Component { | ||||||
|         </ProgressCircle> |         </ProgressCircle> | ||||||
|         <ProgressCircle size={size} max={24} progress={hours} stroke="rgb(60, 144, 60)"> |         <ProgressCircle size={size} max={24} progress={hours} stroke="rgb(60, 144, 60)"> | ||||||
|           <DigitBlock suffix="h"> |           <DigitBlock suffix="h"> | ||||||
|             {hours.toLocaleString(locale, { |             {Math.floor(hours).toLocaleString(locale, { | ||||||
|               minimumIntegerDigits, |               minimumIntegerDigits, | ||||||
|               useGrouping, |               useGrouping, | ||||||
|             })} |             })} | ||||||
|  | @ -77,7 +80,7 @@ export default class Countdown extends React.Component { | ||||||
|         </ProgressCircle> |         </ProgressCircle> | ||||||
|         <ProgressCircle size={size} max={60} progress={minutes} stroke="rgb(160, 154, 40)"> |         <ProgressCircle size={size} max={60} progress={minutes} stroke="rgb(160, 154, 40)"> | ||||||
|           <DigitBlock suffix="m"> |           <DigitBlock suffix="m"> | ||||||
|             {minutes.toLocaleString(locale, { |             {Math.floor(minutes).toLocaleString(locale, { | ||||||
|               minimumIntegerDigits, |               minimumIntegerDigits, | ||||||
|               useGrouping, |               useGrouping, | ||||||
|             })} |             })} | ||||||
|  | @ -85,7 +88,7 @@ export default class Countdown extends React.Component { | ||||||
|         </ProgressCircle> |         </ProgressCircle> | ||||||
|         <ProgressCircle size={size} max={60} progress={seconds} stroke="rgb(193,63,88)"> |         <ProgressCircle size={size} max={60} progress={seconds} stroke="rgb(193,63,88)"> | ||||||
|           <DigitBlock suffix="s"> |           <DigitBlock suffix="s"> | ||||||
|             {durationMoment.seconds().toLocaleString(locale, { |             {Math.floor(seconds).toLocaleString(locale, { | ||||||
|               minimumIntegerDigits, |               minimumIntegerDigits, | ||||||
|               useGrouping, |               useGrouping, | ||||||
|             })} |             })} | ||||||
|  |  | ||||||
|  | @ -5,7 +5,7 @@ | ||||||
|   top: 0 |   top: 0 | ||||||
| 
 | 
 | ||||||
| .progressValue | .progressValue | ||||||
|   transition: stroke-dashoffset 1s linear |   transition: stroke-dashoffset 0.15s linear | ||||||
| 
 | 
 | ||||||
| .progressCircleContainer | .progressCircleContainer | ||||||
|   position: relative |   position: relative | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue