Files
com.gregkilmer.www/services/site/src/components/blog/PageChips.astro
T
Claude 57721efbcd Link roundup posts from Shelf cards and keep long link lists short
Shelf game cards show the post about the game, as Library rows already
do. A make's chip prefers its own build log and says Blog for other
posts. Post chips and Connected pages count the links past the first
few, so a roundup linking a hundred items stays readable.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012aSbo2D1qP8cMFQCykf7kx
2026-10-18 17:09:43 +00:00

27 lines
683 B
Plaintext

---
/**
* A post's page chips. A roundup can link a hundred pages, so past the first
* few the rest are counted; the post itself links every one.
*/
import Chip from "@gk/ui/components/Chip.astro";
import type { PageLink } from "../../lib/blog.ts";
interface Props {
links: PageLink[];
max?: number;
}
const { links, max = 5 } = Astro.props;
const shown = links.length > max + 1 ? links.slice(0, max) : links;
const more = links.length - shown.length;
---
{shown.map((l) => <Chip href={l.href}>{l.label}</Chip>)}
{more > 0 && <span class="more">and {more} more</span>}
<style>
.more {
font-size: 12px;
color: var(--gk-muted);
white-space: nowrap;
}
</style>