@@ -129,34 +129,48 @@ function IconContainer({
129
129
130
130
const [ hovered , setHovered ] = useState ( false ) ;
131
131
132
+ const handleClick = ( event : React . MouseEvent ) => {
133
+ if ( to . startsWith ( "#" ) ) {
134
+ event . preventDefault ( ) ;
135
+ const targetElement = document . querySelector ( to ) ;
136
+ if ( targetElement ) {
137
+ targetElement . scrollIntoView ( { behavior : "smooth" } ) ;
138
+ } else {
139
+ console . error ( `Element not found: ${ to } ` ) ;
140
+ }
141
+ } else {
142
+ // For external links, allow the default behavior
143
+ window . open ( to , "_blank" ) ; // Open in a new tab
144
+ }
145
+ } ;
146
+
132
147
return (
133
- < a href = { to } > { /* Change here */ }
148
+ < motion . div
149
+ ref = { ref }
150
+ style = { { width, height } }
151
+ onMouseEnter = { ( ) => setHovered ( true ) }
152
+ onMouseLeave = { ( ) => setHovered ( false ) }
153
+ onClick = { handleClick }
154
+ className = "aspect-square rounded-full bg-gray-200 dark:bg-neutral-800 flex items-center justify-center relative cursor-pointer"
155
+ >
156
+ < AnimatePresence >
157
+ { hovered && (
158
+ < motion . div
159
+ initial = { { opacity : 0 , y : 10 , x : "-50%" } }
160
+ animate = { { opacity : 1 , y : 0 , x : "-50%" } }
161
+ exit = { { opacity : 0 , y : 2 , x : "-50%" } }
162
+ className = "px-2 py-0.5 whitespace-pre rounded-md bg-gray-100 border dark:bg-neutral-800 dark:border-neutral-900 dark:text-white border-gray-200 text-neutral-700 absolute left-1/2 -translate-x-1/2 -top-8 w-fit text-xs"
163
+ >
164
+ { title }
165
+ </ motion . div >
166
+ ) }
167
+ </ AnimatePresence >
134
168
< motion . div
135
- ref = { ref }
136
- style = { { width, height } }
137
- onMouseEnter = { ( ) => setHovered ( true ) }
138
- onMouseLeave = { ( ) => setHovered ( false ) }
139
- className = "aspect-square rounded-full bg-gray-200 dark:bg-neutral-800 flex items-center justify-center relative"
169
+ style = { { width : widthIcon , height : heightIcon } }
170
+ className = "flex items-center justify-center"
140
171
>
141
- < AnimatePresence >
142
- { hovered && (
143
- < motion . div
144
- initial = { { opacity : 0 , y : 10 , x : "-50%" } }
145
- animate = { { opacity : 1 , y : 0 , x : "-50%" } }
146
- exit = { { opacity : 0 , y : 2 , x : "-50%" } }
147
- className = "px-2 py-0.5 whitespace-pre rounded-md bg-gray-100 border dark:bg-neutral-800 dark:border-neutral-900 dark:text-white border-gray-200 text-neutral-700 absolute left-1/2 -translate-x-1/2 -top-8 w-fit text-xs"
148
- >
149
- { title }
150
- </ motion . div >
151
- ) }
152
- </ AnimatePresence >
153
- < motion . div
154
- style = { { width : widthIcon , height : heightIcon } }
155
- className = "flex items-center justify-center"
156
- >
157
- { icon }
158
- </ motion . div >
172
+ { icon }
159
173
</ motion . div >
160
- </ a >
174
+ </ motion . div >
161
175
) ;
162
176
}
0 commit comments