"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) => ( ))}
{filtered.length === 0 && (
Нет материалов в этой категории
)} {filtered.map((article, index) => (
{article.alt}
{article.tag} {article.meta}

{article.title}

))}
); }