Skip to content

Commit e9897a6

Browse files
authored
Merge pull request #15652 from ethereum/fix-story
Fix failing story
2 parents 5e1fb70 + 60a96b8 commit e9897a6

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

src/components/BannerGrid/BannerGrid.stories.tsx

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1+
import { useTranslations } from "next-intl"
12
import { MdInfoOutline } from "react-icons/md"
23
import { Meta, StoryObj } from "@storybook/react"
34

45
import { ChildOnlyProp } from "@/lib/types"
56

6-
import { TwImage } from "@/components/Image"
7-
import InlineLink from "@/components/Link"
7+
import { Image } from "@/components/Image"
88
import Tooltip from "@/components/Tooltip"
9-
10-
import { getTranslation } from "@/storybook-utils"
9+
import InlineLink from "@/components/ui/Link"
1110

1211
import { langViewportModes } from "../../../.storybook/modes"
1312
import { ContentContainer } from "../MdComponents"
@@ -50,14 +49,18 @@ type Story = StoryObj<typeof meta>
5049

5150
const PAGE_WHAT_IS_ETH = "page-what-is-ethereum"
5251

53-
const tooltipContent = ({ apiUrl, apiProvider, ariaLabel }) => (
54-
<div>
55-
{getTranslation("data-provided-by", "common")}{" "}
56-
<InlineLink href={apiUrl} aria-label={ariaLabel}>
57-
{apiProvider}
58-
</InlineLink>
59-
</div>
60-
)
52+
const tooltipContent = ({ apiUrl, apiProvider, ariaLabel }) => {
53+
const t = useTranslations("common")
54+
55+
return (
56+
<div>
57+
{t("data-provided-by")}{" "}
58+
<InlineLink href={apiUrl} aria-label={ariaLabel}>
59+
{apiProvider}
60+
</InlineLink>
61+
</div>
62+
)
63+
}
6164

6265
const StatPrimary = (props: ChildOnlyProp) => (
6366
<div className="mb-4 text-5xl leading-none" {...props} />
@@ -96,7 +99,7 @@ export const BannerImage: Story = {
9699
return (
97100
<BannerComponent>
98101
<BannerImageComponent>
99-
<TwImage src={stats} alt="" width={400} />
102+
<Image src={stats} alt="" width={400} />
100103
</BannerImageComponent>
101104
</BannerComponent>
102105
)
@@ -105,16 +108,15 @@ export const BannerImage: Story = {
105108

106109
export const BannerGridCell: Story = {
107110
render: () => {
111+
const t = useTranslations(PAGE_WHAT_IS_ETH)
112+
108113
return (
109114
<BannerComponent>
110115
<BannerBodyComponent>
111116
<BannerGridCellComponent>
112117
<StatPrimary>4k+</StatPrimary>
113118
<StatDescription>
114-
{getTranslation(
115-
"page-what-is-ethereum-ethereum-in-numbers-stat-1-desc",
116-
PAGE_WHAT_IS_ETH
117-
)}
119+
{t("page-what-is-ethereum-ethereum-in-numbers-stat-1-desc")}
118120
<span className="whitespace-nowrap">
119121
&nbsp;
120122
<Tooltip
@@ -139,6 +141,8 @@ export const BannerGridCell: Story = {
139141

140142
export const BannerGrid: Story = {
141143
render: () => {
144+
const t = useTranslations(PAGE_WHAT_IS_ETH)
145+
142146
return (
143147
<BannerComponent>
144148
<BannerBodyComponent>
@@ -147,10 +151,7 @@ export const BannerGrid: Story = {
147151
<BannerGridCellComponent key={item}>
148152
<StatPrimary>{item}k+</StatPrimary>
149153
<StatDescription>
150-
{getTranslation(
151-
"page-what-is-ethereum-ethereum-in-numbers-stat-1-desc",
152-
PAGE_WHAT_IS_ETH
153-
)}
154+
{t("page-what-is-ethereum-ethereum-in-numbers-stat-1-desc")}
154155
<span className="whitespace-nowrap">
155156
&nbsp;
156157
<Tooltip
@@ -172,7 +173,7 @@ export const BannerGrid: Story = {
172173
</BannerGridComponent>
173174
</BannerBodyComponent>
174175
<BannerImageComponent>
175-
<TwImage src={stats} alt="" width={400} />
176+
<Image src={stats} alt="" width={400} />
176177
</BannerImageComponent>
177178
</BannerComponent>
178179
)

0 commit comments

Comments
 (0)