@@ -99,17 +99,32 @@ const AnimatedBackground = () => (
99
99
100
100
const LoginBanner = ( ) => {
101
101
const [ currentIndex , setCurrentIndex ] = useState < number > ( 0 )
102
+ const [ isHovering , setIsHovering ] = useState < boolean > ( false )
103
+
104
+ const handleMouseEnter = ( ) => {
105
+ setIsHovering ( true )
106
+ }
107
+
108
+ const handleMouseLeave = ( ) => {
109
+ setIsHovering ( false )
110
+ }
102
111
103
112
useEffect ( ( ) => {
104
113
const testimonialCount = TESTIMONIAL_CARD_DATA . length
105
- const interval = setInterval ( ( ) => {
106
- setCurrentIndex ( ( prevIndex ) => ( prevIndex + 1 ) % testimonialCount )
107
- } , TESTIMONIAL_CARD_INTERVAL )
114
+ let interval : ReturnType < typeof setInterval >
115
+
116
+ if ( ! isHovering ) {
117
+ interval = setInterval ( ( ) => {
118
+ setCurrentIndex ( ( prevIndex ) => ( prevIndex + 1 ) % testimonialCount )
119
+ } , TESTIMONIAL_CARD_INTERVAL )
120
+ }
108
121
109
122
return ( ) => {
110
- clearInterval ( interval )
123
+ if ( interval ) {
124
+ clearInterval ( interval )
125
+ }
111
126
}
112
- } , [ ] )
127
+ } , [ isHovering ] )
113
128
114
129
const { quote, name, designation, iconName } = TESTIMONIAL_CARD_DATA [ currentIndex ]
115
130
@@ -150,6 +165,8 @@ const LoginBanner = () => {
150
165
opacity : { duration : 0.75 , ease : TRANSITION_EASE_CURVE } ,
151
166
x : { duration : 0.85 , ease : TRANSITION_EASE_CURVE } ,
152
167
} }
168
+ onMouseEnter = { handleMouseEnter }
169
+ onMouseLeave = { handleMouseLeave }
153
170
className = "flexbox-col dc__gap-20"
154
171
>
155
172
< div className = "fs-14 fw-4 lh-1-5 cn-9 dc__truncate--clamp-4" > { quote } "</ div >
0 commit comments