@@ -24,9 +24,9 @@ export interface PageHeaderLinkProps extends ButtonProps {
2424
2525export interface ContentHeaderProps extends React . PropsWithChildren {
2626 /** Title for content header */
27- title : string ;
27+ title : React . ReactNode ;
2828 /** Optional subtitle for content header */
29- subtitle ?: string ;
29+ subtitle ?: React . ReactNode ;
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) */
@@ -50,8 +50,8 @@ const useStyles = createUseStyles({
5050} ) ;
5151
5252export const ContentHeader : React . FunctionComponent < React . PropsWithChildren < ContentHeaderProps > > = ( {
53- title,
54- subtitle,
53+ title = null ,
54+ subtitle = null ,
5555 linkProps,
5656 icon,
5757 label,
@@ -64,7 +64,7 @@ export const ContentHeader: React.FunctionComponent<React.PropsWithChildren<Cont
6464
6565 return (
6666 < PageSection variant = "light" >
67- { breadcrumbs && (
67+ { breadcrumbs && (
6868 < div className = "pf-v5-u-mb-md" >
6969 { breadcrumbs }
7070 </ div >
@@ -84,9 +84,11 @@ export const ContentHeader: React.FunctionComponent<React.PropsWithChildren<Cont
8484 < Split hasGutter >
8585 < SplitItem >
8686 < TextContent >
87- < Text className = "pf-v5-u-mb-sm" component = "h1" ouiaId = { `${ ouiaId } -title` } >
88- { title }
89- </ Text >
87+ { typeof title === 'string' ? (
88+ < Text className = "pf-v5-u-mb-sm" component = "h1" ouiaId = { `${ ouiaId } -title` } >
89+ { title }
90+ </ Text >
91+ ) : title }
9092 </ TextContent >
9193 </ SplitItem >
9294 { label && (
@@ -102,13 +104,21 @@ export const ContentHeader: React.FunctionComponent<React.PropsWithChildren<Cont
102104 ) }
103105 </ Split >
104106 < TextContent >
105- { subtitle && (
107+ { typeof subtitle === 'string' ? (
106108 < Text component = "p" ouiaId = { `${ ouiaId } -subtitle` } >
107109 { subtitle }
108110 </ Text >
109- ) }
111+ ) : subtitle }
110112 { linkProps && (
111- < 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 } >
113+ < Button
114+ variant = { ButtonVariant . link }
115+ component = "a"
116+ ouiaId = { `${ ouiaId } -link-button` }
117+ isInline
118+ icon = { linkProps . isExternal ? < ExternalLinkAltIcon className = 'pf-v5-u-ml-sm' /> : null }
119+ iconPosition = "end"
120+ { ...linkProps }
121+ >
112122 { linkProps . label }
113123 </ Button >
114124 ) }
@@ -117,6 +127,7 @@ export const ContentHeader: React.FunctionComponent<React.PropsWithChildren<Cont
117127 </ Flex >
118128 { children }
119129 </ PageSection >
120- ) } ;
130+ ) ;
131+ } ;
121132
122133export default ContentHeader ;
0 commit comments