Skip to content

Commit

Permalink
Merge pull request #11928 from lucas-amberg/fix_whitepaper
Browse files Browse the repository at this point in the history
Fix url on whitepaper page to properly access whitepaper pdf [fixes #11918]
  • Loading branch information
nhsz authored Feb 2, 2024
2 parents 6afb437 + 1febe24 commit aecb21d
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions src/components/Link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const BaseLink = forwardRef(function Link(
href,
}

if (isInternalPdf || isExternal) {
if (isExternal) {
return (
<ChakraLink
isExternal
Expand All @@ -95,9 +95,7 @@ export const BaseLink = forwardRef(function Link(
customEventOptions ?? {
eventCategory: `Link`,
eventAction: `Clicked`,
eventName: `Clicked on ${
isInternalPdf ? "internal PDF" : "external link"
}`,
eventName: "Clicked on external link",
eventValue: href,
}
)
Expand All @@ -120,6 +118,32 @@ export const BaseLink = forwardRef(function Link(
)
}

if (isInternalPdf) {
return (
<ChakraLink
isExternal
// disable locale prefixing for internal PDFs
// TODO: add i18n support using a rehype plugin (similar as we do for
// images)
locale={false}
onClick={() =>
trackCustomEvent(
customEventOptions ?? {
eventCategory: `Link`,
eventAction: `Clicked`,
eventName: "Clicked on internal PDF",
eventValue: href,
}
)
}
{...commonProps}
as={NextLink}
>
{children}
</ChakraLink>
)
}

if (isHash) {
return (
<ChakraLink
Expand Down

0 comments on commit aecb21d

Please sign in to comment.