@@ -5,7 +5,7 @@ import { FaGithub, FaLinkedin, FaGlobe } from 'react-icons/fa';
5
5
import { FaXTwitter as FaXTwitter } from 'react-icons/fa6' ;
6
6
import { LuExternalLink } from "react-icons/lu" ;
7
7
import { motion } from 'framer-motion' ;
8
- import { useState } from 'react' ;
8
+ import { useState , useEffect } from 'react' ;
9
9
import { BsArrowLeftCircle , BsArrowRightCircle } from 'react-icons/bs' ;
10
10
11
11
import Container from 'components/Container' ;
@@ -17,6 +17,18 @@ export default function About() {
17
17
const { resolvedTheme } = useTheme ( ) ;
18
18
const [ currentIndex , setCurrentIndex ] = useState ( 0 ) ;
19
19
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
+ } , [ ] ) ;
20
32
21
33
const timeline = [
22
34
{
@@ -120,7 +132,7 @@ export default function About() {
120
132
</ div >
121
133
< p > Technical Writer and Open Source Developer</ p >
122
134
< 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" >
124
136
< div className = "absolute inset-0 flex items-center justify-between z-10 px-2" >
125
137
{ currentIndex !== 0 && (
126
138
< button
@@ -140,7 +152,7 @@ export default function About() {
140
152
) }
141
153
</ div >
142
154
143
- < div className = "relative h-full flex justify-center items-center" >
155
+ < div className = "relative h-full flex justify-center items-center overflow-hidden " >
144
156
{ [ - 1 , 0 , 1 ] . map ( ( offset ) => {
145
157
const index = ( currentIndex + offset + timeline . length ) % timeline . length ;
146
158
const shouldShow = ! (
@@ -154,16 +166,16 @@ export default function About() {
154
166
initial = { false }
155
167
animate = { {
156
168
scale : offset === 0 ? 1 : 0.8 ,
157
- x : offset * 260 ,
169
+ x : offset * ( windowWidth < 768 ? 160 : 260 ) ,
158
170
opacity : 1 - Math . abs ( offset ) * 0.3 ,
159
171
zIndex : 2 - Math . abs ( offset )
160
172
} }
161
173
transition = { {
162
174
duration : 0.5
163
175
} }
164
- className = "absolute w-[240px]"
176
+ className = "absolute w-[180px] md:w-[ 240px]"
165
177
>
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` } >
167
179
< div className = "flex flex-col items-start space-y-0.5" >
168
180
< span className = "text-xs text-gray-500 dark:text-gray-400" > { timeline [ index ] . period } </ span >
169
181
< h4 className = "text-base text-gray-900 dark:text-white" > { timeline [ index ] . company } </ h4 >
0 commit comments