42 lines
1.6 KiB
TypeScript
42 lines
1.6 KiB
TypeScript
import { listPosts } from "@cms/db"
|
|
import { Button } from "@cms/ui/button"
|
|
import { getTranslations } from "next-intl/server"
|
|
|
|
import { LanguageSwitcher } from "@/components/language-switcher"
|
|
|
|
export const dynamic = "force-dynamic"
|
|
|
|
export default async function HomePage() {
|
|
const [posts, t] = await Promise.all([listPosts(), getTranslations("Home")])
|
|
|
|
return (
|
|
<main className="mx-auto flex min-h-screen w-full max-w-3xl flex-col gap-6 px-6 py-16">
|
|
<header className="space-y-3">
|
|
<div className="flex flex-wrap items-center justify-between gap-3">
|
|
<p className="text-sm uppercase tracking-[0.2em] text-neutral-500">{t("badge")}</p>
|
|
<LanguageSwitcher />
|
|
</div>
|
|
<h1 className="text-4xl font-semibold tracking-tight">{t("title")}</h1>
|
|
<p className="text-neutral-600">{t("description")}</p>
|
|
</header>
|
|
|
|
<section className="space-y-4 rounded-xl border border-neutral-200 p-6">
|
|
<div className="flex items-center justify-between">
|
|
<h2 className="text-xl font-medium">{t("latestPosts")}</h2>
|
|
<Button variant="secondary">{t("explore")}</Button>
|
|
</div>
|
|
|
|
<ul className="space-y-3">
|
|
{posts.map((post) => (
|
|
<li key={post.id} className="rounded-lg border border-neutral-200 p-4">
|
|
<p className="text-xs uppercase tracking-wide text-neutral-500">{post.status}</p>
|
|
<h3 className="mt-1 text-lg font-medium">{post.title}</h3>
|
|
<p className="mt-2 text-sm text-neutral-600">{post.excerpt ?? t("noExcerpt")}</p>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</section>
|
|
</main>
|
|
)
|
|
}
|