chadtmiller.com/hud
A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts
place.hud.hudkit 0.3.1 Latest 5 packages
0
0
<script lang="ts">
import ClampedText from '../ClampedText.svelte';
import Picture from '../Picture.svelte';
import { translateOf } from '../translate';
import type { Source } from '../types';
// The head of a set or page, read by the
// server: an image beside a kicker, a
// title, a line of `meta` and a subtitle under them. No `image`
// (undefined) draws no image box; a null one draws a placeholder.
let {
title = null,
subtitle = null,
kicker = null,
image = undefined,
meta = []
}: {
title?: string | null;
subtitle?: string | null;
kicker?: string | null;
image?: Source | null;
meta?: readonly string[];
} = $props();
</script>
<header class:with-image={image !== undefined}>
{#if image !== undefined}
<span class="image"><Picture src={image} alt="" placeholder="♪" /></span>
{/if}
<div class="words">
{#if kicker}<p class="kicker">{kicker}</p>{/if}
{#if title}<h2 translate={translateOf(title)}>{title}</h2>{/if}
{#if meta.length > 0}<p class="meta">{#each meta as item, i (i)}{#if i > 0}{' · '}{/if}<span translate={translateOf(item)}>{item}</span>{/each}</p>{/if}
{#if subtitle}<div class="subtitle"><ClampedText text={subtitle} /></div>{/if}
</div>
</header>
<style>
/* The words sit beside the image while there is room for 14rem of them;
in a narrow frame they go under it. */
header {
container-type: inline-size;
display: flex;
flex-wrap: wrap;
align-items: flex-end;
gap: var(--hud-space-3);
}
.image {
flex: none;
width: 6rem;
height: 6rem;
border-radius: var(--border-radius-md);
overflow: hidden;
font-size: 2rem;
}
.words {
display: flex;
flex: 1 1 14rem;
flex-direction: column;
gap: 0.125rem;
min-width: 0;
}
@container (min-width: 36rem) {
.image {
width: 9rem;
height: 9rem;
}
}
p {
margin: 0;
}
.kicker {
color: var(--color-text-tertiary);
font-size: var(--font-text-xs-size);
font-weight: var(--font-weight-semibold);
letter-spacing: 0.04em;
text-transform: uppercase;
}
h2 {
margin: 0;
font-size: var(--font-heading-lg-size);
font-weight: var(--font-weight-semibold);
line-height: var(--font-heading-lg-line-height);
overflow-wrap: anywhere;
}
.meta {
color: var(--color-text-secondary);
font-size: var(--font-text-sm-size);
overflow-wrap: anywhere;
}
.subtitle {
margin-top: var(--hud-space-1);
font-size: var(--font-text-sm-size);
line-height: var(--font-text-sm-line-height);
}
</style>