Skip to content

Commit ec39b2f

Browse files
committed
refactor isInternalPdf logic in Link to not use locale
1 parent 95f578a commit ec39b2f

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

src/components/Link.tsx

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export const BaseLink = forwardRef(function Link(
8686
href,
8787
}
8888

89-
if (isInternalPdf || isExternal) {
89+
if (isExternal) {
9090
return (
9191
<ChakraLink
9292
isExternal
@@ -95,9 +95,7 @@ export const BaseLink = forwardRef(function Link(
9595
customEventOptions ?? {
9696
eventCategory: `Link`,
9797
eventAction: `Clicked`,
98-
eventName: `Clicked on ${
99-
isInternalPdf ? "internal PDF" : "external link"
100-
}`,
98+
eventName: "Clicked on external link",
10199
eventValue: href,
102100
}
103101
)
@@ -120,6 +118,27 @@ export const BaseLink = forwardRef(function Link(
120118
)
121119
}
122120

121+
if (isInternalPdf) {
122+
return (
123+
<NextLink
124+
isExternal
125+
onClick={() =>
126+
trackCustomEvent(
127+
customEventOptions ?? {
128+
eventCategory: `Link`,
129+
eventAction: `Clicked`,
130+
eventName: "Clicked on internal PDF",
131+
eventValue: href,
132+
}
133+
)
134+
}
135+
{...commonProps}
136+
>
137+
{children}
138+
</NextLink>
139+
)
140+
}
141+
123142
if (isHash) {
124143
return (
125144
<ChakraLink

0 commit comments

Comments
 (0)