Skip to content

Commit d9fb2bf

Browse files
authored
Merge pull request #12254 from ethereum/fixHubHeroH1
Use `header` as H1 if `title` is missing in HubHero
2 parents 05a18d7 + 0d8bb14 commit d9fb2bf

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/components/Hero/HubHero/index.tsx

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const HubHero = ({
1313
buttons,
1414
}: CommonHeroProps) => {
1515
if (buttons && buttons.length > 2) {
16-
throw Error(
16+
throw new Error(
1717
"Can not have more than two call-to-action buttons in this hero component."
1818
)
1919
}
@@ -49,21 +49,25 @@ const HubHero = ({
4949
backdropBlur={{ xl: "base" }}
5050
wordBreak="break-word"
5151
>
52-
<Heading
53-
as="h1"
54-
size="sm"
55-
color="body.medium"
56-
fontWeight="normal"
57-
textTransform="uppercase"
58-
>
59-
{title}
60-
</Heading>
52+
{title ? (
53+
<Heading
54+
as="h1"
55+
size="sm"
56+
color="body.medium"
57+
fontWeight="normal"
58+
textTransform="uppercase"
59+
>
60+
{title}
61+
</Heading>
62+
) : null}
6163
<Stack
6264
alignSelf="center"
6365
spacing={{ base: "2", md: "1" }}
6466
maxW="container.md"
6567
>
66-
<Heading size="2xl">{header}</Heading>
68+
<Heading as={title ? "h2" : "h1"} size="2xl">
69+
{header}
70+
</Heading>
6771
<Text size="lg">{description}</Text>
6872
</Stack>
6973
<HStack justify={{ md: "center", xl: "start" }} spacing="4">

0 commit comments

Comments
 (0)