From 9759ab2698e81155cc9c0f38fa2dd4d71ced2fb9 Mon Sep 17 00:00:00 2001 From: aramesh-site deploy Date: Wed, 7 Oct 2026 18:20:14 +0000 Subject: [PATCH] =?UTF-8?q?feat(timeline):=20=D8=AE=D8=B7=20=D8=B1=D9=88?= =?UTF-8?q?=DB=8C=20=D8=AF=D8=A7=DB=8C=D8=B1=D9=87=20=D8=AA=D9=85=D8=A7?= =?UTF-8?q?=D9=85=20=D9=85=DB=8C=E2=80=8C=D8=B4=D9=88=D8=AF=20=D9=88=20?= =?UTF-8?q?=DA=A9=D8=A7=D8=B1=D8=AA=20=D9=BE=D8=A7=DB=8C=D8=A7=D9=86=DB=8C?= =?UTF-8?q?=20=D8=B2=DB=8C=D8=B1=20=D8=A2=D9=86=20=D9=85=DB=8C=E2=80=8C?= =?UTF-8?q?=D9=86=D8=B4=DB=8C=D9=86=D8=AF=20=E2=80=94=20=D9=84=D8=A8=D9=87?= =?UTF-8?q?=D9=94=20=D8=A8=D8=A7=D9=84=D8=A7=DB=8C=20=DA=A9=D8=A7=D8=B1?= =?UTF-8?q?=D8=AA=20=D8=AF=D9=82=DB=8C=D9=82=D8=A7=D9=8B=20=D8=B1=D9=88?= =?UTF-8?q?=DB=8C=20=D9=86=D9=82=D8=B7=D9=87=D9=94=20=D9=BE=D8=A7=DB=8C?= =?UTF-8?q?=D8=A7=D9=86=20=D8=AE=D8=B7=20(=D8=A7=D9=86=D8=AF=D8=A7=D8=B2?= =?UTF-8?q?=D9=87=E2=80=8C=DA=AF=DB=8C=D8=B1=DB=8C=20DOM=20=D8=A8=D8=B1?= =?UTF-8?q?=D8=A7=DB=8C=20=D9=87=D8=B1=20=D9=85=D8=AD=D8=AA=D9=88=D8=A7/?= =?UTF-8?q?=D8=A7=D9=86=D8=AF=D8=A7=D8=B2=D9=87)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/home/Timeline.tsx | 39 ++++++++++++++++++----- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/frontend/src/components/home/Timeline.tsx b/frontend/src/components/home/Timeline.tsx index 1128240..304c10c 100644 --- a/frontend/src/components/home/Timeline.tsx +++ b/frontend/src/components/home/Timeline.tsx @@ -1,4 +1,4 @@ -import React, { useRef } from 'react' +import React, { useLayoutEffect, useRef, useState } from 'react' import { motion, useScroll, useTransform, useInView } from 'framer-motion' import { useSite, type TimelineItem } from '../../api' import { useLang } from '../../i18n/lang' @@ -9,17 +9,17 @@ const ease = [0.23, 1, 0.32, 1] as const type Milestone = TimelineItem -function Item({ item, index, featured = false }: { item: Milestone; index: number; featured?: boolean }) { - const ref = useRef(null) +function Item({ item, index, featured = false, onLi }: { item: Milestone; index: number; featured?: boolean; onLi?: (el: HTMLLIElement | null) => void }) { + const ref = useRef(null) const active = useInView(ref, { once: true, amount: 0.6 }) const onRight = index % 2 === 0 return ( -
  • +
  • { ref.current = el; onLi?.(el) }} className={`relative md:grid md:grid-cols-2 md:gap-16 ${featured ? 'mt-10 md:mt-16' : ''}`}> {/* دایره‌ها: مرکز دایره در موبایل و دسکتاپ دقیقاً روی مرکز خط 2px است */}