Improve layout with hero, cards, typography, TOC and reading progress

This commit is contained in:
2025-11-17 17:07:01 +08:00
parent 237bb083cd
commit 603274d025
8 changed files with 338 additions and 99 deletions

View File

@@ -1,45 +1,31 @@
import Link from 'next/link';
import { getAllPostsSorted } from '@/lib/posts';
import { siteConfig } from '@/lib/config';
import { Hero } from '@/components/hero';
import { PostCard } from '@/components/post-card';
export default function HomePage() {
const posts = getAllPostsSorted().slice(0, siteConfig.postsPerPage);
return (
<section className="space-y-6">
<div>
<h1 className="text-3xl font-bold">
{siteConfig.name}
</h1>
<p className="mt-2 text-gray-600 dark:text-gray-300">
{siteConfig.tagline}
</p>
</div>
<Hero />
<div>
<h2 className="text-xl font-semibold"></h2>
<ul className="mt-3 space-y-2">
<div className="mb-3 flex items-baseline justify-between">
<h2 className="text-xl font-semibold"></h2>
<Link
href="/blog"
className="text-sm text-blue-600 hover:underline dark:text-blue-400"
>
</Link>
</div>
<div className="space-y-4">
{posts.map((post) => (
<li key={post._id}>
<Link href={post.url} className="hover:underline">
{post.title}
</Link>
{post.published_at && (
<span className="ml-2 text-xs text-gray-500">
{new Date(post.published_at).toLocaleDateString(
siteConfig.defaultLocale
)}
</span>
)}
</li>
<PostCard key={post._id} post={post} />
))}
</ul>
<Link
href="/blog"
className="mt-4 inline-block text-sm text-blue-600 hover:underline"
>
</Link>
</div>
</div>
</section>
);