Skip to content

Commit 4479689

Browse files
refactor(ContentHero): allow description prop to accept components
1 parent 289f589 commit 4479689

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

src/components/Hero/ContentHero/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ const ContentHero = (props: ContentHeroProps) => {
3838
<Heading as="h1" size="2xl">
3939
{title}
4040
</Heading>
41-
<Text fontSize="lg">{description}</Text>
41+
{typeof description === "string" ? (
42+
<Text fontSize="lg">{description}</Text>
43+
) : (
44+
description
45+
)}
4246
{buttons && (
4347
<HStack spacing="4">
4448
{buttons.map((button, idx) => {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export const HubHero: StoryObj<typeof meta> = {
6262
<HubHeroComponent
6363
title={t(title)}
6464
header={t(header)}
65-
description={t(description)}
65+
description={t(description as string)}
6666
buttons={buttons}
6767
{...props}
6868
/>

src/lib/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ export type CommonHeroProps<
417417
/**
418418
* Preface text about the content in the given page
419419
*/
420-
description: string
420+
description: ReactNode
421421
}
422422

423423
// Learning Tools

0 commit comments

Comments
 (0)