feat: build index page with sorted post listing and ArticleCard components

This replaces the smoke test index with a real page that:
- Imports getCollection, BaseLayout, NavBar, ArticleCard, getReadingTime
- Fetches all posts and sorts descending by date
- Maps posts to ArticleCard components with title, date, type, summary, slug, readingTime
- Styles .post-list with prose max-width, space-6/space-12 margins, flex column, space-2 gap

Generated with [Amplifier](https://github.com/microsoft/amplifier)

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
This commit is contained in:
Ken
2026-05-26 23:21:07 +00:00
parent 6b754d1646
commit 10804705bc
2 changed files with 174 additions and 21 deletions
+32 -21
View File
@@ -1,28 +1,39 @@
---
import { getCollection } from 'astro:content';
import BaseLayout from '../layouts/BaseLayout.astro';
import NavBar from '../components/NavBar.astro';
import PostHeader from '../components/PostHeader.astro';
import ArticleCard from '../components/ArticleCard.astro';
import { getReadingTime } from '../utils/reading-time';
const posts = await getCollection('posts');
const sortedPosts = posts.sort((a, b) => b.data.date.getTime() - a.data.date.getTime());
---
<BaseLayout title="Crash Test Dev" description="Foundation smoke test">
<BaseLayout title='Crash Test Dev'>
<NavBar slot="nav" />
<PostHeader
title="Speeding Up Webpack Typescript Incremental Builds by 7x"
date={new Date('2019-08-16')}
type="post"
readingTime={12}
/>
<div style="max-width: var(--width-prose); margin-left: auto; margin-right: auto; display: flex; flex-direction: column; gap: var(--space-4);">
<p style="font-family: var(--font-prose); font-size: 18px; color: var(--text-primary); line-height: var(--leading-prose);">
This is the prose voice — Source Serif 4 at 18px. It carries the reader through long-form
content with a warm, readable serif that feels like ink on parchment.
</p>
<p style="font-family: var(--font-structure); font-size: 14px; color: var(--text-secondary); line-height: var(--leading-normal);">
This is the structure voice — Inter at 14px in secondary color. It handles navigation,
labels, metadata, and UI chrome with a clean sans-serif that stays out of the way.
</p>
<code style="display: block; font-family: var(--font-evidence); font-size: var(--type-sm); color: var(--code-text); background: var(--surface-code); padding: var(--space-2); border-radius: var(--rounded-md); border-left: 3px solid var(--accent-primary);">
const buildTime = 7 * previousBuildTime; // evidence voice — JetBrains Mono
</code>
</div>
<section class="post-list" aria-label="All posts">
{sortedPosts.map((post) => (
<ArticleCard
title={post.data.title}
date={post.data.date}
type={post.data.type}
summary={post.data.summary}
slug={post.id}
readingTime={post.body ? getReadingTime(post.body) : undefined}
/>
))}
</section>
</BaseLayout>
<style>
.post-list {
max-width: var(--width-prose);
margin-top: var(--space-6);
margin-bottom: var(--space-12);
margin-left: auto;
margin-right: auto;
display: flex;
flex-direction: column;
gap: var(--space-2);
}
</style>