11"use client" ;
22
3- import { useEffect , useRef , useState } from "react" ;
43import { LazyMotion , domAnimation , useInView } from "framer-motion" ;
4+ import { useEffect , useRef , useState } from "react" ;
55
66const TimeLineData = [
7+ { year : 2025 , text : "Continue as Flutter & Web Front-end developer" } ,
78 { year : 2023 , text : "Start my journey as a Flutter developer" } ,
89 { year : 2022 , text : "Start my journey as a React developer" } ,
910 { year : 2021 , text : "Dive completely into React.js" } ,
@@ -12,11 +13,9 @@ const TimeLineData = [
1213] ;
1314
1415export function TimeLine ( ) {
15- /// TODO: Add color mode support
1616 const colorMode = "dark" ;
1717 const [ , setActiveItem ] = useState ( 0 ) ;
1818 const carouselRef = useRef ( null ) ;
19- // const animRef = useRef(null);
2019 const isInView = useInView ( carouselRef , { once : true } ) ;
2120
2221 const scroll = ( node , left ) => {
@@ -65,65 +64,63 @@ export function TimeLine() {
6564 onScroll = { handleScroll }
6665 className = "flex flex-row flex-nowrap gap-5 justify-between overflow-x-auto snap-x cursor-pointer hide-scroll-bar"
6766 >
68- < >
69- { TimeLineData . map ( ( item , index ) => {
70- return (
71- < li
72- id = { `carousel__item-${ index } ` }
73- key = { index }
74- className = "flex flex-col gap-3 snap-start w-[calc((100%/2)-30px)] sm:w-1/3 md:w-1/6"
75- onClick = { ( e ) => handleClick ( e , index ) }
76- style = { {
77- transform : isInView
78- ? "none"
79- : `${ index === 0 ? "translateY(250px)" : `translateY(${ 200 / index } px)` } ` ,
80- opacity : isInView ? 1 : 0 ,
81- transition : `all 0.9s cubic-bezier(0.17, 0.55, 0.55, 1) ${
82- index === 0 ? 0.5 : 1.05 * index
83- } s`
84- } }
67+ { TimeLineData . map ( ( item , index ) => {
68+ return (
69+ < li
70+ id = { `carousel__item-${ index } ` }
71+ key = { index }
72+ className = { `flex flex-col gap-3 snap-start md:snap-end flex-shrink-0 w-[calc((100%/2)-30px)] sm:w-1/3 md:w-1/6 ${ index === TimeLineData . length - 1 ? "pr-5" : "" } ` }
73+ onClick = { ( e ) => handleClick ( e , index ) }
74+ style = { {
75+ transform : isInView
76+ ? "none"
77+ : `${ index === 0 ? "translateY(250px)" : `translateY(${ 200 / index } px)` } ` ,
78+ opacity : isInView ? 1 : 0 ,
79+ transition : `all 0.9s cubic-bezier(0.17, 0.55, 0.55, 1) ${
80+ index === 0 ? 0.5 : 1.05 * index
81+ } s`
82+ } }
83+ >
84+ < h3
85+ tabIndex = "0"
86+ aria-label = { "What do I do in " + item . year }
87+ className = "flex items-center gap-4 text-2xl font-bold"
8588 >
86- < h3
87- tabIndex = "0"
88- aria-label = { "What do I do in " + item . year }
89- className = "flex items-center gap-4 text-2xl font-bold"
89+ { `${ item . year } ` }
90+ < svg
91+ width = "208"
92+ height = "6"
93+ viewBox = "0 0 208 6"
94+ xmlns = "http://www.w3.org/2000/svg"
95+ fill = { colorMode === "dark" ? "#fff" : "#232323" }
9096 >
91- { `${ item . year } ` }
92- < svg
93- width = "208"
94- height = "6"
95- viewBox = "0 0 208 6"
96- xmlns = "http://www.w3.org/2000/svg"
97- fill = { colorMode === "dark" ? "#fff" : "#232323" }
98- >
99- < path
100- fillRule = "evenodd"
101- clipRule = "evenodd"
102- d = "M2.5 5.5C3.88071 5.5 5 4.38071 5 3V3.5L208 3.50002V2.50002L5 2.5V3C5 1.61929 3.88071 0.5 2.5 0.5C1.11929 0.5 0 1.61929 0 3C0 4.38071 1.11929 5.5 2.5 5.5Z"
103- fillOpacity = "0.5"
104- />
105- < defs >
106- < linearGradient
107- id = "paint0_linear"
108- x1 = "-4.30412e-10"
109- y1 = "0.5"
110- x2 = "208"
111- y2 = "0.500295"
112- gradientUnits = "userSpaceOnUse"
113- >
114- < stop stopColor = "#fff" />
115- < stop offset = "0.79478" stopColor = "#fff" stopOpacity = "0" />
116- </ linearGradient >
117- </ defs >
118- </ svg >
119- </ h3 >
120- < p className = "tracking-wide " tabIndex = "0" >
121- { item . text }
122- </ p >
123- </ li >
124- ) ;
125- } ) }
126- </ >
97+ < path
98+ fillRule = "evenodd"
99+ clipRule = "evenodd"
100+ d = "M2.5 5.5C3.88071 5.5 5 4.38071 5 3V3.5L208 3.50002V2.50002L5 2.5V3C5 1.61929 3.88071 0.5 2.5 0.5C1.11929 0.5 0 1.61929 0 3C0 4.38071 1.11929 5.5 2.5 5.5Z"
101+ fillOpacity = "0.5"
102+ />
103+ < defs >
104+ < linearGradient
105+ id = "paint0_linear"
106+ x1 = "-4.30412e-10"
107+ y1 = "0.5"
108+ x2 = "208"
109+ y2 = "0.500295"
110+ gradientUnits = "userSpaceOnUse"
111+ >
112+ < stop stopColor = "#fff" />
113+ < stop offset = "0.79478" stopColor = "#fff" stopOpacity = "0" />
114+ </ linearGradient >
115+ </ defs >
116+ </ svg >
117+ </ h3 >
118+ < p className = "tracking-wide " tabIndex = "0" >
119+ { item . text }
120+ </ p >
121+ </ li >
122+ ) ;
123+ } ) }
127124 </ ul >
128125 </ LazyMotion >
129126 ) ;
0 commit comments