Skip to content

Commit

Permalink
Merge pull request #13582 from ethereum/fix-glossary-tooltip
Browse files Browse the repository at this point in the history
Fix glossary tooltip links
  • Loading branch information
wackerow authored Aug 6, 2024
2 parents 196ed04 + 025578f commit b5e7da9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
7 changes: 7 additions & 0 deletions src/components/Glossary/GlossaryTooltip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useRouter } from "next/router"
import { Box, Text, VStack } from "@chakra-ui/react"

import Heading from "@/components/Heading"
import InlineLink from "@/components/Link"
import Tooltip, { type TooltipProps } from "@/components/Tooltip"
import Translation from "@/components/Translation"

Expand Down Expand Up @@ -31,6 +32,9 @@ const GlossaryTooltip = ({
<Translation
id={termKey + "-term"}
options={{ ns: "glossary-tooltip" }}
// Override the default `a` tag transformation to avoid circular
// dependency issues
transform={{ a: InlineLink }}
/>
</Heading>
{/**
Expand All @@ -43,6 +47,9 @@ const GlossaryTooltip = ({
<Translation
id={termKey + "-definition"}
options={{ ns: "glossary-tooltip" }}
// Override the default `a` tag transformation to avoid circular
// dependency issues
transform={{ a: InlineLink }}
/>
</Text>
</VStack>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { Box, SimpleGrid } from "@chakra-ui/react"
import type { Meta, StoryObj } from "@storybook/react"

import { ContentContainer } from "@/components/MdComponents"

import RoadmapActionCardComponent from "."

const meta = {
Expand All @@ -11,11 +9,11 @@ const meta = {
decorators: [
(Story) => (
<Box maxW="1008px">
<ContentContainer>
<div>
<SimpleGrid columns={{ base: 1, md: 2 }} spacing={8}>
<Story />
</SimpleGrid>
</ContentContainer>
</div>
</Box>
),
],
Expand Down
4 changes: 2 additions & 2 deletions src/components/Translation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useTranslation } from "next-i18next"

import { getRequiredNamespacesForPage } from "@/lib/utils/translations"

import InlineLink from "./Link"
import TooltipLink from "./TooltipLink"

type TranslationProps = {
id: string
Expand All @@ -16,7 +16,7 @@ type TranslationProps = {
// Custom components mapping to be used by `htmr` when parsing the translation
// text
const defaultTransform = {
a: InlineLink,
a: TooltipLink,
}

// Renders the translation string for the given translation key `id`. It
Expand Down

0 comments on commit b5e7da9

Please sign in to comment.