@@ -4,7 +4,7 @@ import { useTheme } from 'next-themes';
4
4
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
- import { motion } from 'framer-motion' ;
7
+ import { motion , AnimatePresence , PanInfo } from 'framer-motion' ;
8
8
import { useState , useEffect } from 'react' ;
9
9
import { BsArrowLeftCircle , BsArrowRightCircle } from 'react-icons/bs' ;
10
10
@@ -106,6 +106,21 @@ export default function About() {
106
106
} ) ;
107
107
} ;
108
108
109
+ const swipeConfidenceThreshold = 10000 ;
110
+ const swipePower = ( offset : number , velocity : number ) => {
111
+ return Math . abs ( offset ) * velocity ;
112
+ } ;
113
+
114
+ const handleDragEnd = ( e : any , { offset, velocity } : PanInfo ) => {
115
+ const swipe = swipePower ( offset . x , velocity . x ) ;
116
+
117
+ if ( swipe < - swipeConfidenceThreshold ) {
118
+ paginate ( 1 ) ;
119
+ } else if ( swipe > swipeConfidenceThreshold ) {
120
+ paginate ( - 1 ) ;
121
+ }
122
+ } ;
123
+
109
124
return (
110
125
< Container title = "About – Dev" >
111
126
< div className = "flex flex-col justify-center items-start max-w-xl mx-auto mb-16 w-full" >
@@ -173,7 +188,11 @@ export default function About() {
173
188
transition = { {
174
189
duration : 0.5
175
190
} }
176
- className = "absolute w-[180px] md:w-[240px]"
191
+ drag = "x"
192
+ dragConstraints = { { left : 0 , right : 0 } }
193
+ dragElastic = { 1 }
194
+ onDragEnd = { handleDragEnd }
195
+ className = "absolute w-[90vw] sm:w-full max-w-[300px]"
177
196
>
178
197
< 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` } >
179
198
< div className = "flex flex-col items-start space-y-0.5" >
0 commit comments