import { Head } from '@inertiajs/react';
import Heading from '@/components/heading';
import PostForm, { type TaxonomyOption } from './post-form';

type PageProps = {
    postCategories: TaxonomyOption[];
    tags: TaxonomyOption[];
};

export default function CreatePost({ postCategories, tags }: PageProps) {
    return (
        <>
            <Head title="Add post" />

            <div className="flex h-full flex-1 flex-col gap-6 overflow-x-auto p-4">
                <Heading
                    title="Add post"
                    description="Create a post with formatted content."
                />

                <div className="rounded-lg border">
                    <PostForm postCategories={postCategories} tags={tags} />
                </div>
            </div>
        </>
    );
}

CreatePost.layout = {
    breadcrumbs: [
        {
            title: 'Posts',
            href: '/posts',
        },
        {
            title: 'Add post',
            href: '/posts/create',
        },
    ],
};
