Compare commits
4 Commits
v3.0.0-dev
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| f3393f3c07 | |||
| b649af1925 | |||
| aa1a989139 | |||
| 304b523127 |
@@ -19,47 +19,60 @@
|
|||||||
{#if isLink}
|
{#if isLink}
|
||||||
<a
|
<a
|
||||||
{href}
|
{href}
|
||||||
class="btn {color}"
|
class="hitbox-wrapper"
|
||||||
target={isExternal ? '_blank' : undefined}
|
target={isExternal ? '_blank' : undefined}
|
||||||
rel={isExternal ? 'noopener noreferrer' : undefined}
|
rel={isExternal ? 'noopener noreferrer' : undefined}
|
||||||
{...rest}
|
{...rest}
|
||||||
>
|
><span class="btn {color}">
|
||||||
{@render children?.()}
|
{@render children?.()}
|
||||||
|
</span>
|
||||||
</a>
|
</a>
|
||||||
{:else}
|
{:else}
|
||||||
<button class="btn {color}" {onclick} {...rest}>
|
<button class="hitbox-wrapper" {onclick} {...rest}>
|
||||||
{@render children?.()}
|
<span class="btn {color}">{@render children?.()}</span>
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.btn {
|
.hitbox-wrapper {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding: 0.4rem 1.2rem;
|
|
||||||
width: fit-content;
|
|
||||||
min-width: 90px;
|
|
||||||
min-height: 48px;
|
min-height: 48px;
|
||||||
|
min-width: 48px;
|
||||||
|
appearance: none;
|
||||||
|
background: transparent;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 20px;
|
padding: 0 4px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-family: 'URW Gothic', sans-serif;
|
|
||||||
letter-spacing: 0.05ch;
|
|
||||||
font-size: 1rem;
|
|
||||||
font-weight: 600;
|
|
||||||
transition: all 0.2s;
|
|
||||||
box-shadow: var(--shadow-std);
|
|
||||||
user-select: none;
|
|
||||||
-webkit-user-select: none;
|
|
||||||
-webkit-tap-highlight-color: transparent;
|
-webkit-tap-highlight-color: transparent;
|
||||||
touch-action: manipulation;
|
}
|
||||||
|
.btn {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: fit-content;
|
||||||
|
flex-shrink: 0;
|
||||||
|
padding: 0 1.2rem;
|
||||||
|
min-width: 90px;
|
||||||
|
height: 36px;
|
||||||
|
border-radius: 20px;
|
||||||
|
border: none;
|
||||||
|
box-shadow: var(--shadow-small);
|
||||||
|
font-family: 'URW Gothic', sans-serif;
|
||||||
|
font-size: 0.93rem;
|
||||||
|
font-weight: 400;
|
||||||
|
letter-spacing: 0.05ch;
|
||||||
|
transition:
|
||||||
|
all 0.1s ease,
|
||||||
|
box-shadow 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.accent {
|
.accent {
|
||||||
background-color: var(--color-accent);
|
background-color: var(--color-accent);
|
||||||
color: var(--color-title);
|
color: var(--color-title);
|
||||||
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.brand {
|
.brand {
|
||||||
@@ -72,11 +85,11 @@
|
|||||||
color: var(--color-title);
|
color: var(--color-title);
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn:hover {
|
.hitbox-wrapper:hover .btn {
|
||||||
filter: brightness(1.5);
|
filter: brightness(1.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn.active {
|
.hitbox-wrapper:active .btn {
|
||||||
transform: scale(0.98);
|
transform: scale(0.98);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
42
src/lib/components/ui/TimezoneWarning.svelte
Normal file
42
src/lib/components/ui/TimezoneWarning.svelte
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
import { slide } from 'svelte/transition';
|
||||||
|
|
||||||
|
let isNotLondon = $state(false);
|
||||||
|
let londonZone = $state('Greenwich Mean Time');
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
const userTZ = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||||
|
isNotLondon = userTZ !== 'Europe/London';
|
||||||
|
|
||||||
|
const parts = new Intl.DateTimeFormat('en-GB', {
|
||||||
|
timeZone: 'Europe/London',
|
||||||
|
timeZoneName: 'long'
|
||||||
|
}).formatToParts(new Date());
|
||||||
|
|
||||||
|
londonZone = parts.find((p) => p.type === 'timeZoneName')?.value || 'UK Time';
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if isNotLondon}
|
||||||
|
<div transition:slide={{duration: 300}} class="tzWarn"><p class="tzText">
|
||||||
|
All times are shown in <strong>{londonZone}</strong>
|
||||||
|
</p></div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.tzWarn {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
width: 100%;
|
||||||
|
padding: 1rem 0 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tzText {
|
||||||
|
width: 80%;
|
||||||
|
text-align: center;
|
||||||
|
margin: auto;
|
||||||
|
font-family: 'URW Gothic', sans-serif;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -22,8 +22,7 @@
|
|||||||
<div
|
<div
|
||||||
class="btn-container"
|
class="btn-container"
|
||||||
animate:flip={{ duration: flipDuration }}
|
animate:flip={{ duration: flipDuration }}
|
||||||
in:fade={{ duration: 200, delay: 100 }}
|
in:fade|global={{ duration: 200 }}
|
||||||
out:fade={{ duration: 150 }}
|
|
||||||
>
|
>
|
||||||
<Button href={`/board?loc=${station.c}`}
|
<Button href={`/board?loc=${station.c}`}
|
||||||
><span class="stn-name">{station.n}</span></Button
|
><span class="stn-name">{station.n}</span></Button
|
||||||
@@ -37,8 +36,13 @@
|
|||||||
|
|
||||||
<style>
|
<style>
|
||||||
.card-content {
|
.card-content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 90%;
|
width: 90%;
|
||||||
|
min-height: 98px;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
padding: 10px 0 10px 0;
|
padding: 10px 0 10px 0;
|
||||||
}
|
}
|
||||||
@@ -46,14 +50,14 @@
|
|||||||
.stations-flex {
|
.stations-flex {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
gap: 0.75rem;
|
gap: 0.1rem 0.5rem;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-container {
|
.btn-container {
|
||||||
display: block;
|
display: block;
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
will-change: transform;
|
will-change: transform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,7 @@
|
|||||||
/* Shadows */
|
/* Shadows */
|
||||||
--color-shadow: hsla(210, 20%, 5%, 0.35);
|
--color-shadow: hsla(210, 20%, 5%, 0.35);
|
||||||
--shadow-std: 0 4px 12px var(--color-shadow);
|
--shadow-std: 0 4px 12px var(--color-shadow);
|
||||||
|
--shadow-small: 0 4px 6px var(--color-shadow);
|
||||||
--shadow-up: 0 -4px 12px var(--color-shadow);
|
--shadow-up: 0 -4px 12px var(--color-shadow);
|
||||||
--shadow-right: 4px 0 12px var(--color-shadow);
|
--shadow-right: 4px 0 12px var(--color-shadow);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
import { LOCATIONS } from '$lib/locations-object.svelte';
|
import { LOCATIONS } from '$lib/locations-object.svelte';
|
||||||
import { nearestStationsState } from '$lib/geohash.svelte';
|
import { nearestStationsState } from '$lib/geohash.svelte';
|
||||||
|
|
||||||
|
import TimezoneWarning from '$lib/components/ui/TimezoneWarning.svelte';
|
||||||
|
|
||||||
import '$lib/global.css';
|
import '$lib/global.css';
|
||||||
|
|
||||||
import logoText from '$lib/assets/round-logo-text.svg';
|
import logoText from '$lib/assets/round-logo-text.svg';
|
||||||
@@ -78,6 +80,7 @@
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
|
<TimezoneWarning />
|
||||||
{@render children()}
|
{@render children()}
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user