mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
20 lines
479 B
TypeScript
20 lines
479 B
TypeScript
|
const format = (t) => `${pad(t.getUTCHours())}:${pad(t.getUTCMinutes())}:${pad(t.getUTCSeconds())}`;
|
||
|
const pad = (n) => n < 10 ? `0${n}` : n;
|
||
|
|
||
|
const Clock = (props) => {
|
||
|
const divStyle = {
|
||
|
backgroundColor:(props.light ? "#999" : "#000"),
|
||
|
color:"#82FA58",
|
||
|
display:"inline-block",
|
||
|
font:"50px menlo, monaco, monospace",
|
||
|
padding:"15px",
|
||
|
};
|
||
|
return (
|
||
|
<div style={divStyle}>
|
||
|
{format(new Date(props.lastUpdate))}
|
||
|
</div>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export { Clock };
|