chadtmiller.com/monolith
An atproto PDS
0
0
<script lang="ts">
import { onMount, type Snippet } from 'svelte';
import Alert from '#lib/atoms/Alert.svelte';
import { focusFirst } from '#lib/focus';
// A view's layout: the server's host, its heading, its body, an alert
// under it, and a row of actions behind an edge, held at the foot of the
// window while the body scrolls under it. Focus goes where
// spec/OAUTH-PAGES.md says when it appears: the heading takes it, out of
// the tab order, for a view with no button.
let {
heading,
alert = '',
alertId = 'alert',
children,
actions
}: {
heading: string;
alert?: string;
alertId?: string;
children?: Snippet;
actions?: Snippet;
} = $props();
let card: HTMLElement;
onMount(() => focusFirst(card));
</script>
<div class="page">
<section class="card" bind:this={card} aria-labelledby="heading">
<header class="top">
<p class="host">{location.host}</p>
<h1 id="heading" tabindex="-1">{heading}</h1>
</header>
{@render children?.()}
{#if alert}<Alert id={alertId} text={alert} />{/if}
{#if actions}<div class="actions">{@render actions()}</div>{/if}
</section>
</div>
<style>
.page {
display: flex;
justify-content: center;
padding: var(--space-6) var(--space-4);
}
.card {
display: flex;
flex-direction: column;
gap: var(--space-6);
width: 100%;
max-width: var(--card-width);
min-width: 0;
padding: var(--space-8);
border: var(--border) solid var(--line);
border-radius: var(--radius-lg);
background: var(--panel);
}
.top {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: var(--space-3);
}
/* The server's host, set as the landing's wordmark is: mono, quiet,
spaced, on no chip. */
.host {
max-width: 100%;
color: var(--mute);
font-family: var(--font-mono);
font-size: var(--text-sm);
letter-spacing: var(--tracking-wide);
overflow-wrap: anywhere;
}
h1 {
font-size: var(--text-3xl);
font-weight: var(--weight-medium);
line-height: var(--leading-tight);
letter-spacing: var(--tracking-tight);
}
.actions {
position: sticky;
bottom: 0;
display: flex;
flex-wrap: wrap;
gap: var(--space-2);
margin-bottom: calc(-1 * var(--space-3));
padding-block: var(--space-3);
border-top: var(--border) solid var(--line);
background: var(--panel);
}
@media (max-width: 640px) {
.page {
padding: var(--space-4) var(--space-4) var(--space-2);
}
.card {
gap: var(--space-3);
padding: 0;
border: none;
background: var(--bg);
}
.top {
gap: var(--space-2);
}
h1 {
font-size: var(--text-2xl);
}
.actions {
background: var(--bg);
}
}
</style>