-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(board): added clock to board (#1102)
* feat(board): created clock component and added it as an optional parameter to header * fix(board): right shifted the clock in board view * fix(board): fixed css for right shifted clock * fix(clock): changed heading type for the clock * fix(board): removed unnecessary styling in header * fix(clock): added oslo timezone to the clock * chore(board): move clock component to shared * fix(header): removed unused css classes
- Loading branch information
Showing
4 changed files
with
54 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { useEffect, useState } from 'react' | ||
|
||
function Clock() { | ||
const [currentTime, setCurrentTime] = useState(Date.now()) | ||
|
||
useEffect(() => { | ||
const intervalId = setInterval(() => setCurrentTime(Date.now()), 1000) | ||
return () => clearInterval(intervalId) | ||
}, []) | ||
|
||
const time = new Intl.DateTimeFormat('no-NB', { | ||
timeStyle: 'short', | ||
timeZone: 'Europe/Oslo', | ||
}).format(currentTime) | ||
|
||
return <span>{time}</span> | ||
} | ||
|
||
export { Clock } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters