Add time to LDB
This commit is contained in:
parent
b4a3da5174
commit
06edc49967
@ -1,4 +1,4 @@
|
|||||||
<script>
|
<script lang="ts">
|
||||||
const links = [
|
const links = [
|
||||||
{
|
{
|
||||||
title: "Home",
|
title: "Home",
|
||||||
@ -8,6 +8,22 @@
|
|||||||
];
|
];
|
||||||
import { page } from "$app/stores";
|
import { page } from "$app/stores";
|
||||||
import { IconHome } from "@tabler/icons-svelte";
|
import { IconHome } from "@tabler/icons-svelte";
|
||||||
|
import { onMount } from "svelte";
|
||||||
|
|
||||||
|
let currentTime: string = "00:00:00"
|
||||||
|
function updateTime() {
|
||||||
|
const now = new Date();
|
||||||
|
const hours = now.getHours().toString().padStart(2, '0');
|
||||||
|
const mins = now.getMinutes().toString().padStart(2, '0');
|
||||||
|
const secs = now.getSeconds().toString().padStart(2, '0');
|
||||||
|
currentTime = `${hours}:${mins}:${secs}`
|
||||||
|
}
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
updateTime();
|
||||||
|
const interval = setInterval(updateTime, 1000);
|
||||||
|
return () => clearInterval(interval);
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
@ -15,7 +31,7 @@
|
|||||||
<a class="footerLink" href={item.path} class:active={$page.url.pathname == item.path}>
|
<a class="footerLink" href={item.path} class:active={$page.url.pathname == item.path}>
|
||||||
<svelte:component this={item.icon} />
|
<svelte:component this={item.icon} />
|
||||||
<br />
|
<br />
|
||||||
<span>{item.title}</span>
|
<span class="title">{item.title}</span>
|
||||||
</a>
|
</a>
|
||||||
{/each}
|
{/each}
|
||||||
<div class="data-source">
|
<div class="data-source">
|
||||||
@ -26,6 +42,7 @@
|
|||||||
<img id="nre-logo" src="/images/nre/nre-powered_200w.png" alt="Data sourced from National Rail and others" />
|
<img id="nre-logo" src="/images/nre/nre-powered_200w.png" alt="Data sourced from National Rail and others" />
|
||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
|
<span class="clock">{currentTime}</span>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
@ -85,9 +102,17 @@
|
|||||||
margin-top: 3px;
|
margin-top: 3px;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
span {
|
.title {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
margin-bottom: 3px;
|
margin-bottom: 3px;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.clock {
|
||||||
|
color: black;
|
||||||
|
font-size: 10px;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 2px;
|
||||||
|
right: 10px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user