mirror of
https://github.com/Patiun/com.gregkilmer.www.git
synced 2026-11-08 04:08:24 +00:00
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
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
---
|
||||
/**
|
||||
* 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>
|
||||
Reference in New Issue
Block a user