Skip to content

Commit c814d92

Browse files
authored
Merge pull request #13959 from ethereum/shadcn-heros
Shadcn migration - heros
2 parents 6381f6a + 12e5adc commit c814d92

File tree

3 files changed

+20
-53
lines changed

3 files changed

+20
-53
lines changed

src/components/Hero/ContentHero/index.tsx

Lines changed: 17 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,22 @@
1-
import { Box, Heading, SimpleGrid, Stack, Text } from "@chakra-ui/react"
2-
31
import type { CommonHeroProps } from "@/lib/types"
42

53
import Breadcrumbs from "@/components/Breadcrumbs"
6-
import { Image } from "@/components/Image"
4+
import { TwImage } from "@/components/Image"
5+
import { Stack } from "@/components/ui/flex"
76

87
import { CallToAction } from "../CallToAction"
98

109
export type ContentHeroProps = Omit<CommonHeroProps<string>, "header">
1110

1211
const ContentHero = (props: ContentHeroProps) => {
13-
const {
14-
breadcrumbs,
15-
heroImg,
16-
buttons,
17-
title,
18-
description,
19-
blurDataURL,
20-
maxHeight,
21-
} = props
12+
const { breadcrumbs, heroImg, buttons, title, description, blurDataURL } =
13+
props
2214
return (
23-
<Box bgImg="bgMainGradient">
24-
<SimpleGrid
25-
columns={{ base: 1, lg: 2 }}
26-
maxW="1536px"
27-
mx="auto"
28-
alignItems="center"
29-
>
30-
<Box
31-
order={{ lg: 1 }}
32-
py={{ base: 0, lg: 12 }}
33-
height={{
34-
base: "300px",
35-
md: "400px",
36-
lg: maxHeight ? maxHeight : "full",
37-
}}
38-
>
39-
<Image
15+
<div className="bg-gradient-main">
16+
<div className="mx-auto grid max-w-screen-2xl grid-cols-1 items-center lg:grid-cols-2">
17+
<div className="h-[300px] md:h-[400px] lg:order-1 lg:h-full lg:py-12">
18+
<TwImage
19+
className="box h-full max-h-[451px] w-full flex-auto object-contain md:flex-none"
4020
src={heroImg}
4121
alt=""
4222
priority
@@ -45,25 +25,19 @@ const ContentHero = (props: ContentHeroProps) => {
4525
height={451}
4626
// TODO: adjust value when the old theme breakpoints are removed (src/theme.ts)
4727
sizes="(max-width: 992px) 100vw, 760px"
48-
boxSize="full"
49-
style={{ objectFit: "contain" }}
50-
flex={{ base: "1 1 100%", md: "none" }}
51-
maxHeight={451}
5228
/>
53-
</Box>
54-
<Stack p={{ base: "8", lg: "16" }} spacing="9" justify="center">
29+
</div>
30+
<Stack className="justify-center gap-9 p-8 lg:p-16">
5531
<Breadcrumbs {...breadcrumbs} />
56-
<Stack spacing="6">
57-
<Heading as="h1" size="2xl">
58-
{title}
59-
</Heading>
32+
<Stack className="gap-6">
33+
<h1>{title}</h1>
6034
{typeof description === "string" ? (
61-
<Text fontSize="lg">{description}</Text>
35+
<p className="text-lg">{description}</p>
6236
) : (
6337
description
6438
)}
6539
{buttons && (
66-
<Stack direction={{ base: "column", md: "row" }} spacing="4">
40+
<Stack className="flex-col gap-4 md:flex-row">
6741
{buttons.map((button, idx) => {
6842
if (!button) return
6943
return <CallToAction key={idx} index={idx} {...button} />
@@ -75,8 +49,8 @@ const ContentHero = (props: ContentHeroProps) => {
7549
* Add conditional Big Stat box here
7650
*/}
7751
</Stack>
78-
</SimpleGrid>
79-
</Box>
52+
</div>
53+
</div>
8054
)
8155
}
8256

src/components/Hero/MdxHero/index.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
import { Heading, Stack } from "@chakra-ui/react"
2-
31
import type { CommonHeroProps } from "@/lib/types"
42

53
import Breadcrumbs from "@/components/Breadcrumbs"
4+
import { Stack } from "@/components/ui/flex"
65

76
export type MdxHeroProps = Pick<CommonHeroProps, "breadcrumbs" | "title">
87

98
const MdxHero = ({ breadcrumbs, title }: MdxHeroProps) => (
10-
<Stack py="8" px="6" spacing="6" w="full">
9+
<Stack className="w-full gap-6 px-6 py-8">
1110
<Breadcrumbs {...breadcrumbs} />
12-
<Heading as="h1" size="2xl">
13-
{title}
14-
</Heading>
11+
<h1>{title}</h1>
1512
</Stack>
1613
)
1714

src/lib/types.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -458,10 +458,6 @@ export type CommonHeroProps<
458458
* Preface text about the content in the given page
459459
*/
460460
description: ReactNode
461-
/**
462-
* The maximum height of the image in the hero
463-
*/
464-
maxHeight?: string
465461
}
466462

467463
// Learning Tools

0 commit comments

Comments
 (0)