import { Card, CardContent } from "@/components/ui/card";

type TagStat = { name: string; count: number };

type Props = {
  tagStats: TagStat[];
};

export default function ContentCategory({ tagStats }: Props) {
  return (
    <section className="py-20">
      <div className="container mx-auto px-6">
        <h2 className="mb-12 text-center text-3xl font-bold">Tag Populer</h2>

        {tagStats.length === 0 ? (
          <p className="text-center text-muted-foreground">
            Tag akan muncul setelah ada artikel yang dipublikasikan.
          </p>
        ) : (
          <Card className="border-1 rounded-2xl shadow-xl">
            <CardContent className="space-y-8 p-10">
              {tagStats.map((item, index) => (
                <div
                  key={item.name}
                  className="flex items-center justify-between"
                >
                  <div className="flex items-center gap-4">
                    <div
                      className={`h-3 w-3 rounded-full ${
                        index % 2 === 0 ? "bg-[#0f3b63]" : "bg-[#b07c18]"
                      }`}
                    />

                    <span className="text-lg font-medium text-[#0f3b63]">
                      {item.name}
                    </span>
                  </div>

                  <span className="text-lg text-gray-500">{item.count}</span>
                </div>
              ))}
            </CardContent>
          </Card>
        )}
      </div>
    </section>
  );
}
