@@ -12,10 +12,39 @@ import {
1212 TooltipContent ,
1313 TooltipTrigger ,
1414} from '@/components/ui/tooltip'
15+ import { useState , useEffect , useRef } from 'react'
1516
1617const IndexPage = ( {
1718 posts : p ,
1819} : InferGetStaticPropsType < typeof getStaticProps > ) => {
20+ const [ showAnimation , setShowAnimation ] = useState ( false )
21+ const [ isHovering , setIsHovering ] = useState ( false )
22+ const timeoutRef = useRef < NodeJS . Timeout | null > ( null )
23+
24+ const handleMouseEnter = ( ) => {
25+ setIsHovering ( true )
26+ timeoutRef . current = setTimeout ( ( ) => {
27+ setShowAnimation ( true )
28+ } , 1000 )
29+ }
30+
31+ const handleMouseLeave = ( ) => {
32+ setIsHovering ( false )
33+ setShowAnimation ( false )
34+ if ( timeoutRef . current ) {
35+ clearTimeout ( timeoutRef . current )
36+ timeoutRef . current = null
37+ }
38+ }
39+
40+ useEffect ( ( ) => {
41+ return ( ) => {
42+ if ( timeoutRef . current ) {
43+ clearTimeout ( timeoutRef . current )
44+ }
45+ }
46+ } , [ ] )
47+
1948 const description = `Oi, sou o Rafael Thayto, prazer! :)
2049
2150Atualmente tenho mais de ${ getYearsOfProfessionalExperience ( ) } anos de experiência
@@ -107,17 +136,35 @@ pensamentos (tanto em inglês quanto em português).`
107136
108137 < main className = "max-w-4xl mx-auto mt-6 bg-neutral-50 dark:bg-slate-800 py-6 px-4 sm:px-24" >
109138 < div className = "flex mt-2 items-center justify-items-center justify-start flex-col sm:flex-row" >
110- < div className = "relative w-20 h-20 group cursor-pointer" >
111- < div className = "absolute -inset-1 bg-gradient-to-r from-blue-600 via-purple-600 to-pink-600 rounded-full opacity-0 group-hover:opacity-75 blur-sm group-hover:animate-spin transition-all duration-300" > </ div >
112- < div className = "absolute -inset-0.5 bg-gradient-to-r from-blue-500 via-purple-500 to-pink-500 rounded-full opacity-0 group-hover:opacity-100 group-hover:animate-spin transition-all duration-300" > </ div >
139+ < div
140+ className = "relative w-20 h-20 cursor-pointer"
141+ onMouseEnter = { handleMouseEnter }
142+ onMouseLeave = { handleMouseLeave }
143+ >
144+ < div
145+ className = { `absolute -inset-1 bg-gradient-to-r from-blue-600 via-purple-600 to-pink-600 rounded-full blur-sm transition-all duration-500 ${
146+ showAnimation ? 'opacity-75 animate-spin' : 'opacity-0'
147+ } `}
148+ > </ div >
149+ < div
150+ className = { `absolute -inset-0.5 bg-gradient-to-r from-blue-500 via-purple-500 to-pink-500 rounded-full transition-all duration-500 ${
151+ showAnimation ? 'opacity-100 animate-spin' : 'opacity-0'
152+ } `}
153+ > </ div >
154+
155+ { isHovering && ! showAnimation && (
156+ < div className = "absolute -inset-2 rounded-full !border-2 !border-blue-500 !animate-pulse !opacity-60" > </ div >
157+ ) }
113158
114159 < div className = "relative w-full h-full bg-neutral-50 dark:bg-slate-800 rounded-full p-0.5" >
115160 < Image
116161 src = "/static/images/profile.jpg"
117162 alt = "Thayto's profile picture"
118163 fill
119164 priority
120- className = "rounded-full object-cover transition-transform duration-300 group-hover:scale-105"
165+ className = { `rounded-full object-cover transition-transform duration-300 ${
166+ isHovering ? 'scale-105' : 'scale-100'
167+ } `}
121168 />
122169 </ div >
123170 </ div >
0 commit comments