~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/hud

A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts

0
0
54 lines · 1.4 KB Raw History
<script lang="ts">
	import { formatCompact } from './format';
	import { clock } from './view/clock.svelte';
	import Glyph from './Glyph.svelte';
	import type { IconName } from './icons';

	// A count, small and quiet: an icon, the number in compact form (1.2k),
	// `+` after it where there are more than it counts, and what it counts,
	// for those who cannot see the icon.
	let { value, icon = null, label = null, more = false }: { value: number; icon?: IconName | null; label?: string | null; more?: boolean } = $props();
</script>

<span class="stat" title={label ? `${value}${more ? '+' : ''} ${label}` : undefined}>
	{#if icon}
		<svg viewBox="0 0 24 24" aria-hidden="true">
			<Glyph name={icon} />
		</svg>
	{/if}
	<span>{formatCompact(value, clock.fixed)}{more ? '+' : ''}</span>
	{#if label}<span class="label">{label}</span>{/if}
</span>

<style>
	.stat {
		display: inline-flex;
		align-items: center;
		gap: 0.3em;
		color: var(--color-text-secondary);
		font-size: var(--font-text-sm-size);
		font-variant-numeric: tabular-nums;
		line-height: 1;
		white-space: nowrap;
	}

	svg {
		flex: none;
		width: 1.4em;
		height: 1.4em;
		fill: none;
		stroke: currentColor;
		stroke-width: 2;
		stroke-linecap: round;
		stroke-linejoin: round;
	}

	.label {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}
</style>