import Link from "next/link";
import { Category, Post } from "@/lib/types";

export function ArticleCard({ post, category }: { post: Post; category?: Category }) {
  return (
    <article className={`article-card ${post.sponsored ? "sponsored" : ""}`}>
      <Link href={`/nota/${post.slug}`}>
        <img src={post.image} alt={post.imageAlt} loading="lazy" />
      </Link>
      <div className="article-card-content">
        <span className="kicker">{post.sponsored ? "Patrocinado" : category?.name || post.category}</span>
        <h3>
          <Link href={`/nota/${post.slug}`}>{post.title}</Link>
        </h3>
        <p>{post.excerpt}</p>
      </div>
    </article>
  );
}
