import { BlogData } from "@/schema/blog";
import Image from "next/image";
import Link from "next/link";

type CardBlogProps = {
  data: BlogData;
};

export default function CardBlog({ data }: CardBlogProps) {
  return (
    <div>
      <article className="post-default">
        <div className="h-64 relative">
          <Link href="#">
            <Image src={data.img?.url ?? ""} alt={data.img?.alt ?? ""} fill />
          </Link>
        </div>
        <div className="post-default-body">
          <div className="post-default-title">
            <h4>
              <a href="blog-post.html">{data.title}</a>
            </h4>
          </div>
          <div className="post-default-divider"></div>
          <div className="post-default-text">
            <p>{data.description}</p>
          </div>
          <div className="post-default-time">
            <span className="icon mdi mdi-clock"></span>
            <a href="#">{data.posted_at}</a>
          </div>
        </div>
      </article>
    </div>
  );
}
