Skip to content

Commit d08e2d0

Browse files
authored
Merge branch 'dev' into walletsPage
2 parents e46f031 + 4d1f0fc commit d08e2d0

File tree

22 files changed

+2160
-184
lines changed

22 files changed

+2160
-184
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ import ContentHeroComponent, { ContentHeroProps } from "."
55

66
type ContentHeroType = typeof ContentHeroComponent
77

8+
import contentHeroImg from "../../../../public/mainnet.png"
9+
810
const meta = {
911
title: "Organisms / Layouts / Hero",
1012
component: ContentHeroComponent,
1113
parameters: {
1214
layout: "none",
1315
},
1416
argTypes: {
15-
heroImgSrc: {
17+
heroImg: {
1618
table: {
1719
disable: true,
1820
},
@@ -22,9 +24,6 @@ const meta = {
2224

2325
export default meta
2426

25-
// TODO: Double-check correct way to mock Next.js image data
26-
const mockImgData = "/mainnet.png"
27-
2827
export const ContentHero: StoryObj = {
2928
render: () => {
3029
// eslint-disable-next-line react-hooks/rules-of-hooks
@@ -52,7 +51,7 @@ export const ContentHero: StoryObj = {
5251
return (
5352
<ContentHeroComponent
5453
breadcrumbs={{ slug: "/en/run-a-node/" }}
55-
heroImgSrc={mockImgData}
54+
heroImg={contentHeroImg}
5655
title={t("hero-header")}
5756
description={t("hero-subtitle")}
5857
buttons={buttons}
Lines changed: 37 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,54 @@
11
import { Box, Heading, HStack, SimpleGrid, Stack, Text } from "@chakra-ui/react"
22

3-
import type { CommonHeroProps } from "@/lib/types"
3+
import { CommonHeroProps } from "@/lib/types"
44

5-
import Breadcrumbs, { type BreadcrumbsProps } from "@/components/Breadcrumbs"
6-
import { CallToAction } from "@/components/Hero/CallToAction"
5+
import Breadcrumbs, { BreadcrumbsProps } from "@/components/Breadcrumbs"
76
import { Image } from "@/components/Image"
87

8+
import { CallToAction } from "../CallToAction"
9+
910
export interface ContentHeroProps extends Omit<CommonHeroProps, "header"> {
1011
breadcrumbs: BreadcrumbsProps
1112
}
1213

13-
const ContentHero = ({
14-
breadcrumbs,
15-
heroImgSrc,
16-
buttons,
17-
title,
18-
description,
19-
}: ContentHeroProps) => (
20-
<Box bgImg="bgMainGradient">
21-
<SimpleGrid columns={{ base: 1, lg: 2 }} maxW="1536px" mx="auto" gap="4">
22-
<Box
23-
height={{ base: "300px", md: "400px", lg: "full" }}
24-
order={{ lg: 1 }}
25-
>
26-
<Image
27-
alt=""
28-
src={heroImgSrc}
29-
priority
30-
style={{ objectFit: "contain" }}
31-
boxSize="full"
32-
/>
33-
</Box>
34-
<Stack p={{ base: "8", lg: "16" }} spacing="9" justify="center">
35-
<Breadcrumbs {...breadcrumbs} />
36-
<Stack spacing="6">
37-
<Heading as="h1" size="2xl">
38-
{title}
39-
</Heading>
40-
<Text fontSize="lg">{description}</Text>
41-
{buttons && (
14+
const ContentHero = (props: ContentHeroProps) => {
15+
const { breadcrumbs, heroImg, buttons, title, description } = props
16+
return (
17+
<Box bgImg="bgMainGradient">
18+
<SimpleGrid columns={{ base: 1, lg: 2 }} maxW="1536px" mx="auto" gap="4">
19+
<Box
20+
height={{ base: "300px", md: "400px", lg: "full" }}
21+
order={{ lg: 1 }}
22+
>
23+
<Image
24+
src={heroImg}
25+
alt=""
26+
priority
27+
style={{ objectFit: "contain" }}
28+
boxSize="full"
29+
/>
30+
</Box>
31+
<Stack p={{ base: "8", lg: "16" }} spacing="9" justify="center">
32+
<Breadcrumbs {...breadcrumbs} />
33+
<Stack spacing="6">
34+
<Heading as="h1" size="2xl">
35+
{title}
36+
</Heading>
37+
<Text fontSize="lg">{description}</Text>
4238
<HStack spacing="4">
43-
{buttons.map((button, idx) => {
39+
{buttons!.map((button, idx) => {
4440
if (!button) return
4541
return <CallToAction key={idx} {...button} />
4642
})}
4743
</HStack>
48-
)}
44+
</Stack>
45+
{/* TODO:
46+
* Add conditional Big Stat box here
47+
*/}
4948
</Stack>
50-
{/* TODO:
51-
* Add conditional Big Stat box here
52-
*/}
53-
</Stack>
54-
</SimpleGrid>
55-
</Box>
56-
)
49+
</SimpleGrid>
50+
</Box>
51+
)
52+
}
5753

5854
export default ContentHero

src/components/Hero/HomeHero/HomeHero.stories.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as React from "react"
12
import { Meta, StoryObj } from "@storybook/react"
23

34
import HomeHeroComponent from "."
@@ -11,7 +12,7 @@ const meta = {
1112
layout: "none",
1213
},
1314
argTypes: {
14-
heroImgSrc: {
15+
heroImg: {
1516
table: {
1617
disable: true,
1718
},
@@ -21,10 +22,11 @@ const meta = {
2122

2223
export default meta
2324

24-
// TODO: Double-check correct way to mock Next.js image data
25-
const mockImgData = "/home/hero.png"
25+
import homeHeroImg from "../../../../public/home/hero.png"
2626

2727
export const HomeHero: StoryObj<typeof meta> = {
28-
args: { heroImgSrc: mockImgData },
28+
args: {
29+
heroImg: homeHeroImg,
30+
},
2931
render: (args) => <HomeHeroComponent {...args} />,
3032
}

src/components/Hero/HomeHero/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ import { ButtonLink } from "@/components/Buttons"
77
import { Image } from "@/components/Image"
88
import Morpher from "@/components/Morpher"
99

10-
export type HomeHeroProps = Pick<CommonHeroProps, "heroImgSrc">
10+
export type HomeHeroProps = Pick<CommonHeroProps, "heroImg">
1111

12-
const HomeHero = ({ heroImgSrc }: HomeHeroProps) => {
12+
const HomeHero = ({ heroImg }: HomeHeroProps) => {
1313
const { t } = useTranslation("page-index")
1414
return (
1515
<Box>
1616
<Box h={440}>
1717
<Image
18-
src={heroImgSrc}
18+
src={heroImg}
1919
alt={t("page-index:page-index-hero-image-alt")}
2020
w="full"
2121
h="full"
@@ -34,11 +34,11 @@ const HomeHero = ({ heroImgSrc }: HomeHeroProps) => {
3434
<Morpher />
3535
<VStack spacing="6">
3636
<Heading as="h1" size="2xl">
37-
{t("page-index-title")}
37+
{t("page-index:page-index-title")}
3838
</Heading>
39-
<Text size="xl">{t("page-index-description")}</Text>
39+
<Text size="xl">{t("page-index:page-index-description")}</Text>
4040
<ButtonLink href="/learn/">
41-
{t("page-index-title-button")}
41+
{t("page-index:page-index-title-button")}
4242
</ButtonLink>
4343
</VStack>
4444
</Stack>

src/components/Hero/HubHero/HubHero.stories.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import { useTranslation } from "next-i18next"
33
import { Box } from "@chakra-ui/react"
44
import { Meta, StoryObj } from "@storybook/react"
55

6-
import type { CommonHeroProps as HubHeroProps } from "@/lib/types"
7-
86
import HubHeroComponent from "./"
97

108
type HubHeroType = typeof HubHeroComponent
@@ -26,22 +24,23 @@ const meta = {
2624

2725
export default meta
2826

29-
// TODO: Double-check correct way to mock Next.js image data
30-
const mockImgData = "/heroes/learn-hub-hero.png"
27+
import { CommonHeroProps } from "@/lib/types"
28+
29+
import learnHubHeroImg from "../../../../public/heroes/learn-hub-hero.png"
3130

3231
export const HubHero: StoryObj<typeof meta> = {
3332
args: {
3433
title: "learn-hub",
3534
header: "hero-header",
3635
description: "hero-subtitle",
37-
heroImgSrc: mockImgData,
36+
heroImg: learnHubHeroImg,
3837
},
3938

4039
render: ({ title, header, description, ...props }) => {
4140
// eslint-disable-next-line react-hooks/rules-of-hooks
4241
const { t } = useTranslation()
4342

44-
const buttons: HubHeroProps["buttons"] = [
43+
const buttons: CommonHeroProps["buttons"] = [
4544
{
4645
content: t("hero-button-lets-get-started"),
4746
toId: "what-is-crypto-ethereum",

src/components/Hero/HubHero/index.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,27 @@ import type { CommonHeroProps } from "@/lib/types"
1212
import { CallToAction } from "@/components/Hero/CallToAction"
1313
import { Image } from "@/components/Image"
1414

15-
const HubHero = ({
16-
heroImgSrc,
17-
title,
18-
header,
19-
description,
20-
buttons,
21-
}: CommonHeroProps) => {
15+
const HubHero = (props: CommonHeroProps) => {
16+
const { heroImg, title, header, description, buttons } = props
17+
18+
if (buttons && buttons.length > 2) {
19+
throw Error(
20+
"Can not have more than two call-to-action buttons in this hero component."
21+
)
22+
}
23+
2224
const height = useBreakpointValue({
2325
base: "192px",
2426
md: "256px",
2527
lg: "320px",
2628
xl: "576px",
2729
"2xl": "672px",
2830
})
31+
2932
return (
3033
<Box position="relative">
3134
<Image
32-
src={heroImgSrc}
35+
src={heroImg}
3336
alt=""
3437
priority
3538
sizes="100vw"

src/components/Hero/MdxHero/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Heading, Stack } from "@chakra-ui/react"
22

3-
import type { CommonHeroProps } from "@/lib/types"
3+
import { CommonHeroProps } from "@/lib/types"
44

55
import Breadcrumbs, { type BreadcrumbsProps } from "@/components/Breadcrumbs"
66

src/components/PageHero.tsx

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
import type { ReactNode } from "react"
2-
import {
3-
Box,
4-
Flex,
5-
Heading,
6-
Wrap,
7-
WrapItem,
8-
} from "@chakra-ui/react"
2+
import { Box, Center, Flex, Heading, Wrap, WrapItem } from "@chakra-ui/react"
93

104
import {
115
Button,
@@ -28,7 +22,7 @@ type ButtonType = Omit<ButtonProps, "content"> & {
2822
matomo: MatomoEventOptions
2923
}
3024

31-
type ContentType = {
25+
export type ContentType = {
3226
buttons?: (ButtonLinkType | ButtonType)[]
3327
title: ReactNode
3428
header: ReactNode
@@ -151,22 +145,24 @@ const PageHero = ({
151145
)}
152146
{children}
153147
</Box>
154-
<Image
155-
src={image}
148+
<Center
156149
flex="1 1 50%"
157-
alignSelf="center"
150+
maxWidth={{ base: "560px", lg: "624px" }}
158151
mt={{ base: 0, lg: 12 }}
159152
ms={{ base: 0, lg: 12 }}
160-
maxWidth={{ base: "560px", lg: "624px" }}
161-
sizes="100%"
162-
style={{
163-
width: "100%",
164-
height: "auto",
165-
objectFit: "contain",
166-
}}
167-
alt={alt}
168-
priority
169-
/>
153+
>
154+
<Image
155+
src={image}
156+
sizes="100%"
157+
style={{
158+
width: "100%",
159+
height: "auto",
160+
objectFit: "contain",
161+
}}
162+
alt={alt}
163+
priority
164+
/>
165+
</Center>
170166
</Flex>
171167
</Box>
172168
)

src/components/Trilemma/index.tsx

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from "react"
1+
import { useTranslation } from "next-i18next"
22
import {
33
Drawer,
44
DrawerCloseButton,
@@ -9,17 +9,16 @@ import {
99
useToken,
1010
} from "@chakra-ui/react"
1111

12-
import Card from "../Card"
13-
import OldHeading from "../OldHeading"
14-
import Text from "../OldText"
15-
import Translation from "../Translation"
12+
import Card from "@/components/Card"
13+
import OldHeading from "@/components/OldHeading"
14+
import Text from "@/components/OldText"
1615

17-
import { IProps as TriangleSVGProps,TriangleSVG } from "./Triangle"
16+
import { IProps as TriangleSVGProps, TriangleSVG } from "./Triangle"
1817
import { useTrilemma } from "./useTrilemma"
1918

20-
export interface IProps {}
19+
const Trilemma = () => {
20+
const { t } = useTranslation("page-roadmap-vision")
2121

22-
const Trilemma: React.FC<IProps> = () => {
2322
const {
2423
trilemmaChecks,
2524
mobileModalOpen,
@@ -53,19 +52,19 @@ const Trilemma: React.FC<IProps> = () => {
5352
}}
5453
>
5554
<OldHeading fontSize="2rem" mt={0}>
56-
<Translation id="page-roadmap-vision-trilemma-h2" />
55+
{t("page-roadmap-vision-trilemma-h2")}
5756
</OldHeading>
5857
<Text>
59-
<Translation id="page-roadmap-vision-trilemma-p" />
58+
{t("page-roadmap-vision-trilemma-p")}
6059
</Text>
6160
<Text>
62-
<Translation id="page-roadmap-vision-trilemma-p-1" />
61+
{t("page-roadmap-vision-trilemma-p-1")}
6362
</Text>
6463
<Text>
65-
<Translation id="page-roadmap-vision-trilemma-p-2" />
64+
{t("page-roadmap-vision-trilemma-p-2")}
6665
</Text>
6766
<Text fontWeight={600} hideFrom={lgBp}>
68-
<Translation id="page-roadmap-vision-trilemma-modal-tip" />:
67+
{t("page-roadmap-vision-trilemma-modal-tip")}:
6968
</Text>
7069
<Card {...cardDetail} mt={8} minH="300px" hideBelow={lgBp} />
7170
</Flex>

0 commit comments

Comments
 (0)