import { notFound } from "next/navigation";
import { SiteHeader } from "@/components/SiteHeader";
import { SiteFooter } from "@/components/SiteFooter";

type Params = { slug: string };

export async function generateMetadata({
  params,
}: {
  params: Promise<Params>;
}) {
  const { slug } = await params;
  return { title: slug };
}

export default async function PostDetailPage({
  params,
}: {
  params: Promise<Params>;
}) {
  const { slug } = await params;
  if (!slug) notFound();

  return (
    <>
      <SiteHeader />
      <article className="mx-auto max-w-3xl px-6 py-24">
        <span className="mb-4 block font-label text-xs uppercase tracking-[0.4em] text-secondary">
          POST //{" "}
          <code className="text-on-surface-variant">{slug}</code>
        </span>
        <h1 className="mb-6 font-headline text-4xl font-bold tracking-tight md:text-6xl">
          Post detail
        </h1>
        <p className="font-body text-lg text-on-surface-variant">
          Body renders from Payload{" "}
          <code className="font-label text-primary">posts</code> once wired.
        </p>
      </article>
      <SiteFooter />
    </>
  );
}
