import Link from "next/link";
import type { Metadata } from "next";
import { createBlogPost } from "@/app/actions/admin";
import { PageHeader } from "@/app/admin/_components/ui";
import BlogForm from "@/app/admin/_components/BlogForm";

export const metadata: Metadata = {
  title: "New blog post",
};

export default function NewBlogPage() {
  return (
    <div>
      <PageHeader
        title="Add blog post"
        description="Create a homepage story or update."
        action={
          <Link
            href="/admin/blogs"
            className="text-sm font-semibold text-[#1f3fb8] hover:underline"
          >
            ← Back
          </Link>
        }
      />
      <BlogForm action={createBlogPost} submitLabel="Create post" />
    </div>
  );
}
