Skip to content

Commit aa1de81

Browse files
authored
fix: make content header subtitle optional (#541)
1 parent 727fa35 commit aa1de81

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

packages/module/src/ContentHeader/ContentHeader.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ export interface PageHeaderLinkProps extends ButtonProps {
2525
export interface ContentHeaderProps extends React.PropsWithChildren {
2626
/** Title for content header */
2727
title: string;
28-
/** Subtitle for content header */
29-
subtitle: string;
28+
/** Optional subtitle for content header */
29+
subtitle?: string;
3030
/** Optional link below subtitle */
3131
linkProps?: PageHeaderLinkProps;
3232
/** Optional icon for content header (appears to the left of the content header's title with a divider) */
@@ -102,9 +102,11 @@ export const ContentHeader: React.FunctionComponent<React.PropsWithChildren<Cont
102102
)}
103103
</Split>
104104
<TextContent>
105-
<Text component="p" ouiaId={`${ouiaId}-subtitle`}>
106-
{subtitle}
107-
</Text>
105+
{subtitle && (
106+
<Text component="p" ouiaId={`${ouiaId}-subtitle`}>
107+
{subtitle}
108+
</Text>
109+
)}
108110
{linkProps && (
109111
<Button variant={ButtonVariant.link} component="a" ouiaId={`${ouiaId}-link-button`} isInline icon={linkProps.isExternal ? <ExternalLinkAltIcon className='pf-v5-u-ml-sm' /> : null} iconPosition="end" {...linkProps}>
110112
{linkProps.label}

0 commit comments

Comments
 (0)