'use client'; import { useRef, useEffect } from 'react'; import { useTranslations } from "next-intl"; type props = { dateLabel: string; category: string; roles: string[]; client: string; }; function MetaItem({ label, children }: { label: string; children: React.ReactNode }) { return (
{label}
{children}
); } export function ProjectMeta({ dateLabel, category, roles, client }: props) { const ref = useRef(null); const t = useTranslations('projectPage.meta'); useEffect(() => { const el = ref.current; if (!el) return; const observer = new IntersectionObserver( ([entry]) => { if (entry.isIntersecting) { el.classList.add('visible'); observer.unobserve(el); } }, { threshold: 0.2 } ); observer.observe(el); return () => observer.disconnect(); }, []); return (
{/* Top divider */}
{dateLabel} {category}
{roles.map((role) => ( {role} ))}
{client}
{/* Bottom divider */}
); }