feat: cover image display + date formatting + footer spacing

- PostCard: render coverImage above meta/content with lazy loading
- Post detail: render coverImage below title with lazy loading
- Format dates via toLocaleDateString (e.g. Jan 15, 2025)
- Footer top margin: mt-20 → mt-16
This commit is contained in:
2026-06-01 22:50:10 -05:00
parent 06481d0c26
commit 7a17d4c538
3 changed files with 21 additions and 3 deletions

View File

@@ -4,7 +4,7 @@ import Link from 'next/link';
import { m } from 'motion/react';
import type { PostMeta } from '@/lib/posts';
export function PostCard({ slug, title, date, excerpt, tags = [], author, readingTime, index = 0 }: PostMeta & { index?: number }) {
export function PostCard({ slug, title, date, excerpt, tags = [], author, readingTime, index = 0, coverImage }: PostMeta & { index?: number }) {
return (
<m.article
initial={{ opacity: 0, y: 20 }}
@@ -14,6 +14,16 @@ export function PostCard({ slug, title, date, excerpt, tags = [], author, readin
className="group relative scroll-mt-20 rounded-xl border border-border bg-canvas p-6 transition-all hover:border-border/80 hover:shadow-card"
>
<Link href={`/posts/${slug}/`} className="block">
{coverImage && (
<div className="mb-4 overflow-hidden rounded-lg">
<img
src={coverImage}
alt={title}
className="w-full h-40 object-cover"
loading="lazy"
/>
</div>
)}
<div className="flex items-center gap-3 text-xs text-ink-soft mb-3">
<time className="font-mono">{date}</time>
{author && <span className="text-ink-soft/70">·</span>}