Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix url on whitepaper page to properly access whitepaper pdf [fixes #11918] #11928

Merged
merged 6 commits into from
Feb 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
nhsz marked this conversation as resolved.
Show resolved Hide resolved
// 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
Loading