@@ -3,7 +3,7 @@ import { Icon } from "@iconify/react";
3
3
import { css } from "panda/css" ;
4
4
import { styled as p } from "panda/jsx" ;
5
5
import { token } from "panda/tokens" ;
6
- import { type ReactElement , type CSSProperties } from "react" ;
6
+ import { type ReactElement , type CSSProperties , useEffect } from "react" ;
7
7
8
8
export function HeaderBody ( {
9
9
externalStyle,
@@ -18,6 +18,20 @@ export function HeaderBody({
18
18
} ) : ReactElement {
19
19
const shouldWhite = externalStyle ?. logo ?. color === token ( "colors.9u-white" ) ;
20
20
21
+ // γͺγ³γ―ι·η§»ζγ«γγ³γγΌγ¬γΌγ‘γγ₯γΌγιγγ
22
+ useEffect ( ( ) => {
23
+ const elements = document . querySelectorAll ( "a" ) ;
24
+ elements . forEach ( ( e ) => {
25
+ e . addEventListener ( "click" , onAnchorClick ) ;
26
+ } ) ;
27
+
28
+ return ( ) => {
29
+ elements . forEach ( ( e ) => {
30
+ e . removeEventListener ( "click" , onAnchorClick ) ;
31
+ } ) ;
32
+ } ;
33
+ } , [ ] ) ;
34
+
21
35
return (
22
36
< p . header
23
37
alignItems = "center"
@@ -48,7 +62,6 @@ export function HeaderBody({
48
62
} }
49
63
height = "max-content"
50
64
href = "/"
51
- onClick = { onAnchorClick }
52
65
style = { externalStyle ?. logo }
53
66
transition = "opacity 0.3s"
54
67
>
@@ -90,18 +103,10 @@ export function HeaderBody({
90
103
} }
91
104
gap = "5"
92
105
>
93
- < p . a href = "/works" onClick = { onAnchorClick } >
94
- Works
95
- </ p . a >
96
- < p . a href = "/blogs" onClick = { onAnchorClick } >
97
- Blog
98
- </ p . a >
99
- < p . a href = "/about" onClick = { onAnchorClick } >
100
- About
101
- </ p . a >
102
- < p . a href = "/contact" onClick = { onAnchorClick } >
103
- Contact
104
- </ p . a >
106
+ < p . a href = "/works" > Works</ p . a >
107
+ < p . a href = "/blogs" > Blog</ p . a >
108
+ < p . a href = "/about" > About</ p . a >
109
+ < p . a href = "/contact" > Contact</ p . a >
105
110
</ p . nav >
106
111
< p . nav
107
112
className = { css ( {
0 commit comments