Skip to content

Commit 60542b4

Browse files
committed
feat: migrate HubHero to tailwind
1 parent 5d32204 commit 60542b4

File tree

1 file changed

+36
-37
lines changed

1 file changed

+36
-37
lines changed

src/components/Hero/HubHero/index.tsx

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

53
import { CallToAction } from "@/components/Hero/CallToAction"
64
import { Image } from "@/components/Image"
5+
import { Stack } from "@/components/ui/flex"
6+
7+
import { cn } from "@/lib/utils/cn"
78

89
export type HubHeroProps = Omit<CommonHeroProps, "breadcrumbs" | "blurDataURL">
910

@@ -21,7 +22,7 @@ const HubHero = ({
2122
}
2223

2324
return (
24-
<Box position="relative">
25+
<div className="relative">
2526
<Image
2627
src={heroImg}
2728
alt=""
@@ -38,55 +39,53 @@ const HubHero = ({
3839
}}
3940
/>
4041
<Stack
41-
spacing="4"
42-
p={{ base: "4", lg: "8" }}
43-
textAlign={{ base: "center", xl: "start" }}
44-
borderRadius={{ xl: "base" }}
45-
bg={{ xl: "hubHeroContentBg" }}
46-
position={{ xl: "absolute" }}
47-
maxW={{ xl: "sm" }}
48-
top={{ xl: "50%" }}
49-
transform={{ xl: "translateY(-50%)" }}
50-
backdropFilter={{ xl: "auto" }}
51-
backdropBlur={{ xl: "base" }}
52-
wordBreak="break-word"
53-
sx={{
54-
"inset-inline-start": { xl: "32px" },
55-
}}
42+
// spacing :: used space-y as considering it to be column
43+
className={cn(
44+
"gap-0 space-y-4 p-4 lg:p-8",
45+
"text-center xl:text-start",
46+
"xl:rounded",
47+
"xl:bg-[#222222cc]",
48+
"xl:absolute xl:top-1/2 xl:max-w-sm",
49+
"xl:-translate-y-1/2 xl:transform",
50+
"xl:backdrop-blur xl:backdrop-filter",
51+
"break-words",
52+
"xl:start-[32px]"
53+
)}
5654
>
5755
{title ? (
58-
<Text
59-
as="h1"
60-
size="md"
61-
color="body.medium"
62-
fontWeight="normal"
63-
textTransform="uppercase"
64-
>
56+
<h1 className="text-md font-normal uppercase text-body-medium">
6557
{title}
66-
</Text>
58+
</h1>
6759
) : null}
6860
<Stack
69-
alignSelf="center"
70-
spacing={{ base: "2", md: "1" }}
71-
maxW="container.md"
61+
// TODO: Spacings on @chakra Stack behaves differently on different screen sizes
62+
// spacing :: used space-y as considering it to be column
63+
// --eth-sizes-container-md: 768px ==> tailwind max-w-3xl
64+
className="max-w-3xl gap-0 space-y-2 self-center md:space-y-1"
7265
>
73-
<Heading as={title ? "h2" : "h1"} size="2xl">
74-
{header}
75-
</Heading>
76-
<Text size="lg">{description}</Text>
66+
{title ? (
67+
<h2 className="text-4xl lg:text-5xl">{header}</h2>
68+
) : (
69+
<h1 className="text-4xl lg:text-5xl">{header}</h1>
70+
)}
71+
72+
<p className="text-lg">{description}</p>
7773
</Stack>
7874
<Stack
79-
direction={{ base: "column", md: "row" }}
80-
justify={{ md: "center", xl: "start" }}
81-
spacing="4"
75+
className={cn(
76+
"h-fit flex-col gap-0 md:flex-row",
77+
"md:justify-center xl:justify-start",
78+
// spacing :: used space-y & x as considering it to be sm:column md:row
79+
"space-y-4 md:space-x-4 md:space-y-0"
80+
)}
8281
>
8382
{buttons?.map((button, idx) => {
8483
if (!button) return
8584
return <CallToAction key={idx} index={idx} {...button} />
8685
})}
8786
</Stack>
8887
</Stack>
89-
</Box>
88+
</div>
9089
)
9190
}
9291

0 commit comments

Comments
 (0)