mirror of
https://github.com/Since-3/since3-website.git
synced 2026-10-12 21:41:16 +00:00
added full design
This commit is contained in:
parent
c641cfed7e
commit
b2b4a0b076
67 changed files with 4884 additions and 153 deletions
30
modules/shared/ui/components/live-clock.tsx
Normal file
30
modules/shared/ui/components/live-clock.tsx
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
"use client"
|
||||
|
||||
import { useSyncExternalStore } from "react"
|
||||
|
||||
const formatter = new Intl.DateTimeFormat("de-DE", {
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
second: "2-digit",
|
||||
timeZone: "Europe/Berlin",
|
||||
})
|
||||
|
||||
function subscribe(onChange: () => void) {
|
||||
const interval = window.setInterval(onChange, 1000)
|
||||
return () => window.clearInterval(interval)
|
||||
}
|
||||
|
||||
/** Local time in Steinfurt, ticking every second. */
|
||||
export function LiveClock({ className }: { className?: string }) {
|
||||
const time = useSyncExternalStore(
|
||||
subscribe,
|
||||
() => formatter.format(new Date()),
|
||||
() => "--:--:--"
|
||||
)
|
||||
|
||||
return (
|
||||
<time className={className} suppressHydrationWarning>
|
||||
{time}
|
||||
</time>
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue