Make clock divider blink
This commit is contained in:
@@ -21,11 +21,8 @@ export default function Datetime() {
|
|||||||
year: "numeric",
|
year: "numeric",
|
||||||
});
|
});
|
||||||
|
|
||||||
const time = today.toLocaleTimeString(locale, {
|
const hour = today.getHours().toString().padStart(2, "0");
|
||||||
hour: "numeric",
|
const minute = today.getMinutes().toString().padStart(2, "0");
|
||||||
hour12: false,
|
|
||||||
minute: "numeric",
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={style.container}>
|
<div className={style.container}>
|
||||||
@@ -33,7 +30,11 @@ export default function Datetime() {
|
|||||||
<img src="src/assets/clock.png" />
|
<img src="src/assets/clock.png" />
|
||||||
</div>
|
</div>
|
||||||
<div className={style.textContainer}>
|
<div className={style.textContainer}>
|
||||||
<div className={style.time}>{time}</div>
|
<div className={style.time}>
|
||||||
|
{hour}
|
||||||
|
<span className={style.divider}>:</span>
|
||||||
|
{minute}
|
||||||
|
</div>
|
||||||
<div className={style.date}>{date}</div>
|
<div className={style.date}>{date}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -18,3 +18,13 @@ img {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.divider {
|
||||||
|
animation: blink 3s step-end infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes blink {
|
||||||
|
50% {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user