Skip to content

Commit f30f775

Browse files
refactor(Hero): sync styles to latest DS
1 parent 2b45b3f commit f30f775

File tree

4 files changed

+27
-14
lines changed

4 files changed

+27
-14
lines changed

src/components/Hero/ContentHero/ContentHero.stories.tsx

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import { useTranslation } from "next-i18next"
21
import { Meta, StoryObj } from "@storybook/react"
32

43
import ContentHeroComponent, { ContentHeroProps } from "."
54

65
type ContentHeroType = typeof ContentHeroComponent
76

7+
import { getI18n } from "react-i18next"
8+
89
import contentHeroImg from "../../../../public/mainnet.png"
910

1011
const meta = {
@@ -25,13 +26,21 @@ const meta = {
2526
export default meta
2627

2728
export const ContentHero: StoryObj = {
29+
parameters: {
30+
// Set asPath in mock router so the Breadcrums component can render
31+
// the "home" text with correct translation
32+
nextjs: {
33+
router: {
34+
asPath: "/en",
35+
},
36+
},
37+
},
2838
render: () => {
29-
// eslint-disable-next-line react-hooks/rules-of-hooks
30-
const { t } = useTranslation("page-learn")
39+
const { t } = getI18n()
3140

3241
const buttons: ContentHeroProps["buttons"] = [
3342
{
34-
content: t("hero-button-lets-get-started"),
43+
content: t("hero-button-lets-get-started", { ns: "page-learn" }),
3544
toId: "what-is-crypto-ethereum",
3645
matomo: {
3746
eventCategory: "learn hub hero buttons",
@@ -50,10 +59,10 @@ export const ContentHero: StoryObj = {
5059
]
5160
return (
5261
<ContentHeroComponent
53-
breadcrumbs={{ slug: "/en/run-a-node/" }}
62+
breadcrumbs={{ slug: "/run-a-node/" }}
5463
heroImg={contentHeroImg}
55-
title={t("hero-header")}
56-
description={t("hero-subtitle")}
64+
title={t("hero-header", { ns: "page-learn" })}
65+
description={t("hero-subtitle", { ns: "page-learn" })}
5766
buttons={buttons}
5867
/>
5968
)

src/components/Hero/ContentHero/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ const ContentHero = (props: ContentHeroProps) => {
3535
{title}
3636
</Heading>
3737
<Text fontSize="lg">{description}</Text>
38-
<HStack spacing="4">
38+
<Stack direction={{ base: "column", md: "row" }} spacing="4">
3939
{buttons!.map((button, idx) => {
4040
if (!button) return
4141
return <CallToAction key={idx} index={idx} {...button} />
4242
})}
43-
</HStack>
43+
</Stack>
4444
</Stack>
4545
{/* TODO:
4646
* Add conditional Big Stat box here

src/components/Hero/HomeHero/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const HomeHero = ({ heroImg }: HomeHeroProps) => {
1313
const { t } = useTranslation("page-index")
1414
return (
1515
<Box>
16-
<Box h={440}>
16+
<Box h={{ base: "300px", sm: "350px", md: "380px", lg: "440px" }}>
1717
<Image
1818
src={heroImg}
1919
alt={t("page-index:page-index-hero-image-alt")}
@@ -33,11 +33,11 @@ const HomeHero = ({ heroImg }: HomeHeroProps) => {
3333
maxW="2xl"
3434
>
3535
<Morpher />
36-
<VStack spacing="6">
36+
<VStack spacing="6" maxW={{ lg: "2xl" }}>
3737
<Heading as="h1" size="2xl">
3838
{t("page-index:page-index-title")}
3939
</Heading>
40-
<Text size="xl">{t("page-index:page-index-description")}</Text>
40+
<Text>{t("page-index:page-index-description")}</Text>
4141
<ButtonLink href="/learn/">
4242
{t("page-index:page-index-title-button")}
4343
</ButtonLink>

src/components/Hero/HubHero/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,16 @@ const HubHero = ({
7070
</Heading>
7171
<Text size="lg">{description}</Text>
7272
</Stack>
73-
<HStack justify={{ md: "center", xl: "start" }} spacing="4">
73+
<Stack
74+
direction={{ base: "column", md: "row" }}
75+
justify={{ md: "center", xl: "start" }}
76+
spacing="4"
77+
>
7478
{buttons?.map((button, idx) => {
7579
if (!button) return
7680
return <CallToAction key={idx} index={idx} {...button} />
7781
})}
78-
</HStack>
82+
</Stack>
7983
</Stack>
8084
</Box>
8185
)

0 commit comments

Comments
 (0)