"use client"; import { useState } from "react"; import Image from "next/image"; type Article = { href: string; image: string; title: string; tag: string; meta: string; alt: string; }; function ArrowIcon() { return ( ); } const ALL_TAG = "Все"; export default function ArticlesGrid({ articles }: { articles: Article[] }) { const allTags = [ALL_TAG, ...Array.from(new Set(articles.map((a) => a.tag)))]; const [activeTag, setActiveTag] = useState(ALL_TAG); const filtered = activeTag === ALL_TAG ? articles : articles.filter((a) => a.tag === activeTag); return ( Все статьи. {allTags.map((tag) => ( setActiveTag(tag)} className={`px-4 py-2 text-xs font-bold uppercase tracking-wider border transition-all duration-300 ${ activeTag === tag ? "bg-[#7a1b1b] border-[#7a1b1b] text-white" : "border-black/20 text-black/60 hover:border-black/40 hover:text-black" }`} > {tag} ))} {filtered.length === 0 && ( Нет материалов в этой категории )} {filtered.map((article, index) => ( {article.tag} {article.meta} {article.title} ))} ); }