diff options
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/Updates.astro | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/components/Updates.astro b/src/components/Updates.astro new file mode 100644 index 0000000..8fbe795 --- /dev/null +++ b/src/components/Updates.astro @@ -0,0 +1,53 @@ +--- +import updates from "../data/updates.json"; + +const limit = Number(Astro.props.limit ?? 5); +const items = (updates as { date: string; title: string; url: string; group: string }[]).slice(0, limit); +--- + +<ul class="updates"> + {items.map((u) => ( + <li> + <time datetime={u.date}>{u.date.replace(/-/g, ".")}</time> + {u.group && <span class="updates-group">{u.group}</span>} + <a href={u.url}>{u.title}</a> + </li> + ))} +</ul> + +<style> + .updates { + list-style: none; + padding: 0; + margin: 0; + font-size: 0.9rem; + border-top: 1px solid var(--sl-color-gray-5); + } + .updates li { + display: flex; + flex-wrap: wrap; + align-items: baseline; + gap: 0.5rem; + padding: 0.5rem 0; + border-bottom: 1px solid var(--sl-color-gray-5); + } + .updates time { + color: var(--sl-color-gray-3); + font-variant-numeric: tabular-nums; + flex-shrink: 0; + } + .updates-group { + font-size: 0.75rem; + color: var(--sl-color-gray-2); + background: var(--sl-color-gray-6); + border-radius: 3px; + padding: 0.05rem 0.35rem; + flex-shrink: 0; + } + .updates a { + text-decoration: none; + } + .updates a:hover { + text-decoration: underline; + } +</style> |
