'use client'; import { useRef, useEffect } from 'react'; import Link from 'next/link'; import { useTranslations } from "next-intl"; type props = { locale: string; articles: { slug: string; title: string; description: string; cover?: string; }[]; }; export function OtherArticles({ locale, articles }: props) { const ref = useRef(null); const t = useTranslations('blogPage.otherArticles'); useEffect(() => { const el = ref.current; if (!el) return; const observer = new IntersectionObserver( ([entry]) => { if (entry.isIntersecting) { el.querySelectorAll('.reveal').forEach((node, i) => { setTimeout(() => node.classList.add('visible'), i * 120); }); observer.unobserve(el); } }, { threshold: 0.1 } ); observer.observe(el); return () => observer.disconnect(); }, []); if (!articles.length) return null; return (
{/* Divider */}
{/* Label */}
{t('sectionLabel')}

{t('title')}

{articles.map((article, i) => ( {/* Image */}
{article.cover && ( {article.title} )}
{/* Text */}

{article.title}

{article.description}

))}
); }