import { Head } from "$fresh/runtime.ts";
import { Post } from "../types/index.ts";
import { convertUtc } from "../lib/convertUtc.ts";

export const PostHeader = function PostHeader({ post }: PostHeaderOpts) {
  return (
    <>
      <Head>
        <title>Wyatt J. Miller | {post.title}</title>
      </Head>
      <div class="p-6 bg-[#313244]">
        <div class="min-w-screen flex flex-col items-center justify-between bg-[#45475a] rounded-lg shadow-md">
          <div class="sm:mt-14 sm:mb-14 mt-8 mb-8 flex flex-col items-center gap-y-5 gap-x-10 md:flex-row">
            <div class="space-y-2 text-center md:text-left">
              <p class="text-2xl text-[#f5e0dc] font-bold sm:text-4xl">
                {post.title}
              </p>
              <p class="text-md font-medium text-[#E39A9C] sm:text-xl italic">
                by {post.first_name} {post.last_name} posted on{" "}
                {convertUtc(post.created_at)}
              </p>
            </div>
          </div>
        </div>
      </div>
    </>
  );
};

export type PostHeaderOpts = {
  post: Post;
};
