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 { opens, tagOf, type Opener } from '../open';
import Picture from '../Picture.svelte';
import type { Source } from '../types';
// A link to something outside the text, as a card: a preview image
// across the top, then a small line saying what it is (a site's host,
// "Bluesky post"), a title and a description. A click follows it (`open`;
// a link, where it has an address); with nowhere to go it only shows.
let {
kicker,
title,
description = null,
image = null,
open
}: { kicker: string; title: string; description?: string | null; image?: Source | null; open: Opener | null } = $props();
</script>
{#snippet body()}
{#if image}<span class="image"><Picture src={image} alt="" /></span>{/if}
<span class="words">
<span class="kicker">{kicker}</span>
<span class="title">{title}</span>
{#if description}<span class="description">{description}</span>{/if}
</span>
{/snippet}
{#if open}
<svelte:element this={tagOf(open)} {...opens(open)} class="card">{@render body()}</svelte:element>
{:else}
<div class="card">{@render body()}</div>
{/if}
<style>
.card {
display: flex;
flex-direction: column;
width: 100%;
padding: 0;
border: var(--border-width-regular) solid var(--color-border-secondary);
border-radius: var(--border-radius-md);
background: var(--color-background-primary);
color: var(--color-text-primary);
font: inherit;
text-align: start;
overflow: hidden;
}
:is(a, button).card {
cursor: pointer;
}
/* A link: sized as the button is, no line of a link's under its words. */
a.card {
box-sizing: border-box;
text-decoration: none;
}
:is(a, button).card:hover {
border-color: var(--color-border-primary);
background: var(--color-background-secondary);
}
.image {
display: block;
aspect-ratio: 1.91;
border-bottom: var(--border-width-regular) solid var(--color-border-secondary);
background: var(--color-background-tertiary);
}
.words {
display: flex;
flex-direction: column;
gap: 0.125rem;
min-width: 0;
padding: var(--hud-space-2) var(--hud-space-3);
line-height: var(--font-text-sm-line-height);
}
.kicker {
color: var(--color-text-tertiary);
font-size: var(--font-text-xs-size);
overflow-wrap: anywhere;
}
.title {
font-size: var(--font-text-sm-size);
font-weight: var(--font-weight-semibold);
overflow-wrap: anywhere;
}
.description {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
line-clamp: 2;
overflow: hidden;
color: var(--color-text-secondary);
font-size: var(--font-text-sm-size);
overflow-wrap: anywhere;
}
</style>