Compare commits
No commits in common. "3a5087bdc8f10284e00558659978f942ba0afe76" and "172d1ea64ea767caf6e33197500da2d95225a972" have entirely different histories.
3a5087bdc8
...
172d1ea64e
|
@ -9066,14 +9066,6 @@
|
||||||
"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",
|
||||||
|
@ -11089,11 +11081,6 @@
|
||||||
"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), 100);
|
this.interval = setInterval(this.tick.bind(this), 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
|
@ -49,13 +49,10 @@ export default class Countdown extends React.Component {
|
||||||
|
|
||||||
const durationMoment = moment.duration(duration);
|
const durationMoment = moment.duration(duration);
|
||||||
|
|
||||||
const milliseconds = durationMoment.asMilliseconds();
|
const days = durationMoment.days();
|
||||||
const seconds = (milliseconds / 1000) % 60;
|
const hours = durationMoment.hours();
|
||||||
const minutes = (milliseconds / (60 * 1000)) % 60;
|
const minutes = durationMoment.minutes();
|
||||||
const hours = (milliseconds / (60 * 60 * 1000)) % 24;
|
const seconds = durationMoment.seconds();
|
||||||
const days = (milliseconds / (24 * 60 * 60 * 1000));
|
|
||||||
|
|
||||||
console.log({ days, hours, minutes, seconds });
|
|
||||||
|
|
||||||
const size = 160; // @HACK
|
const size = 160; // @HACK
|
||||||
|
|
||||||
|
@ -64,7 +61,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">
|
||||||
{Math.floor(days).toLocaleString(locale, {
|
{days.toLocaleString(locale, {
|
||||||
minimumIntegerDigits,
|
minimumIntegerDigits,
|
||||||
useGrouping,
|
useGrouping,
|
||||||
})}
|
})}
|
||||||
|
@ -72,7 +69,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">
|
||||||
{Math.floor(hours).toLocaleString(locale, {
|
{hours.toLocaleString(locale, {
|
||||||
minimumIntegerDigits,
|
minimumIntegerDigits,
|
||||||
useGrouping,
|
useGrouping,
|
||||||
})}
|
})}
|
||||||
|
@ -80,7 +77,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">
|
||||||
{Math.floor(minutes).toLocaleString(locale, {
|
{minutes.toLocaleString(locale, {
|
||||||
minimumIntegerDigits,
|
minimumIntegerDigits,
|
||||||
useGrouping,
|
useGrouping,
|
||||||
})}
|
})}
|
||||||
|
@ -88,7 +85,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">
|
||||||
{Math.floor(seconds).toLocaleString(locale, {
|
{durationMoment.seconds().toLocaleString(locale, {
|
||||||
minimumIntegerDigits,
|
minimumIntegerDigits,
|
||||||
useGrouping,
|
useGrouping,
|
||||||
})}
|
})}
|
||||||
|
|
|
@ -7,4 +7,4 @@
|
||||||
font-size: 0.5em
|
font-size: 0.5em
|
||||||
text-transform: uppercase
|
text-transform: uppercase
|
||||||
font-weight: bold
|
font-weight: bold
|
||||||
color: #888
|
color: #888
|
|
@ -5,7 +5,7 @@
|
||||||
top: 0
|
top: 0
|
||||||
|
|
||||||
.progressValue
|
.progressValue
|
||||||
transition: stroke-dashoffset 0.15s linear
|
transition: stroke-dashoffset 1s linear
|
||||||
|
|
||||||
.progressCircleContainer
|
.progressCircleContainer
|
||||||
position: relative
|
position: relative
|
||||||
|
|
Loading…
Reference in New Issue