@@ -5,7 +5,7 @@ import { FaGithub, FaLinkedin, FaGlobe } from 'react-icons/fa';
55import { FaXTwitter as FaXTwitter } from 'react-icons/fa6' ;
66import { LuExternalLink } from "react-icons/lu" ;
77import { motion } from 'framer-motion' ;
8- import { useState } from 'react' ;
8+ import { useState , useEffect } from 'react' ;
99import { BsArrowLeftCircle , BsArrowRightCircle } from 'react-icons/bs' ;
1010
1111import Container from 'components/Container' ;
@@ -17,6 +17,18 @@ export default function About() {
1717 const { resolvedTheme } = useTheme ( ) ;
1818 const [ currentIndex , setCurrentIndex ] = useState ( 0 ) ;
1919 const [ direction , setDirection ] = useState ( 0 ) ;
20+ const [ windowWidth , setWindowWidth ] = useState ( 0 ) ;
21+
22+ useEffect ( ( ) => {
23+ // Set initial width
24+ setWindowWidth ( window . innerWidth ) ;
25+
26+ // Handle resize
27+ const handleResize = ( ) => setWindowWidth ( window . innerWidth ) ;
28+ window . addEventListener ( 'resize' , handleResize ) ;
29+
30+ return ( ) => window . removeEventListener ( 'resize' , handleResize ) ;
31+ } , [ ] ) ;
2032
2133 const timeline = [
2234 {
@@ -120,7 +132,7 @@ export default function About() {
120132 </ div >
121133 < p > Technical Writer and Open Source Developer</ p >
122134 < h3 className = "mb-1" > Work Experience</ h3 >
123- < div className = "relative h-[400px] w-full" >
135+ < div className = "relative h-[500px] md:h-[ 400px] w-full" >
124136 < div className = "absolute inset-0 flex items-center justify-between z-10 px-2" >
125137 { currentIndex !== 0 && (
126138 < button
@@ -140,7 +152,7 @@ export default function About() {
140152 ) }
141153 </ div >
142154
143- < div className = "relative h-full flex justify-center items-center" >
155+ < div className = "relative h-full flex justify-center items-center overflow-hidden " >
144156 { [ - 1 , 0 , 1 ] . map ( ( offset ) => {
145157 const index = ( currentIndex + offset + timeline . length ) % timeline . length ;
146158 const shouldShow = ! (
@@ -154,16 +166,16 @@ export default function About() {
154166 initial = { false }
155167 animate = { {
156168 scale : offset === 0 ? 1 : 0.8 ,
157- x : offset * 260 ,
169+ x : offset * ( windowWidth < 768 ? 160 : 260 ) ,
158170 opacity : 1 - Math . abs ( offset ) * 0.3 ,
159171 zIndex : 2 - Math . abs ( offset )
160172 } }
161173 transition = { {
162174 duration : 0.5
163175 } }
164- className = "absolute w-[240px]"
176+ className = "absolute w-[180px] md:w-[ 240px]"
165177 >
166- < div className = { `${ timeline [ index ] . bgColor } p-4 rounded-lg shadow-sm dark:border dark:border-gray-700 transition-colors duration-300 relative overflow-hidden` } >
178+ < div className = { `${ timeline [ index ] . bgColor } p-3 md:p- 4 rounded-lg shadow-sm dark:border dark:border-gray-700 transition-colors duration-300 relative overflow-hidden` } >
167179 < div className = "flex flex-col items-start space-y-0.5" >
168180 < span className = "text-xs text-gray-500 dark:text-gray-400" > { timeline [ index ] . period } </ span >
169181 < h4 className = "text-base text-gray-900 dark:text-white" > { timeline [ index ] . company } </ h4 >
0 commit comments