Skip to content

Commit e91b336

Browse files
committed
Use header as H1 if title missing
1 parent b094f1b commit e91b336

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

src/components/Hero/HubHero/index.tsx

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ const HubHero = ({
1313
buttons,
1414
}: CommonHeroProps) => {
1515
if (buttons && buttons.length > 2) {
16-
throw Error(
17-
"Can not have more than two call-to-action buttons in this hero component."
16+
throw new Error(
17+
"Cannot have more than two call-to-action buttons in this hero component."
1818
)
1919
}
2020

@@ -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">
@@ -77,4 +81,4 @@ const HubHero = ({
7781
)
7882
}
7983

80-
export default HubHero
84+
export default HubHero;

0 commit comments

Comments
 (0)