'use client'; import { useRef, useEffect, useState } from 'react'; import { useTranslations } from "next-intl"; export default function TimelineSection() { const sectionRef = useRef(null); const [visible, setVisible] = useState(false); const t = useTranslations('about'); const lineTop = '58%'; const steps = [ { title: t('step1.title'), text: t('step1.text'), year: '2019', position: 'top' as const, left: '16%', }, { title: t('step2.title'), text: t('step2.text'), year: '2022', position: 'bottom' as const, left: '50%', }, { title: t('step3.title'), text: t('step3.text'), year: '2026', position: 'top' as const, left: '84%', }, ]; useEffect(() => { const section = sectionRef.current; if (!section) return; const observer = new IntersectionObserver( ([entry]) => { if (entry.isIntersecting) { setVisible(true); section.querySelectorAll('.reveal').forEach((el) => el.classList.add('visible')); observer.unobserve(section); } }, { threshold: 0.12 } ); observer.observe(section); return () => observer.disconnect(); }, []); return (
{/* Label */}
{t('sectionLabel')}

{t('title')}

{/* Mobile layout */}
{steps.map((step, i) => (
{step.year}

{step.title}

{step.text}

))}
{/* Desktop timeline */}
{/* Background track */}
{/* Animated progress line */}
{steps.map((step, i) => (
{/* Dot */}
{/* Year label */}
{step.year}
{/* Card */}

{step.title}

{step.text}

))}
); }