Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 0 additions & 58 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 12 additions & 9 deletions packages/module/src/ContentHeader/ContentHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ export interface PageHeaderLinkProps extends ButtonProps {

export interface ContentHeaderProps {
/** Title for content header */
title: string;
title: React.ReactNode;
/** Optional subtitle for content header */
subtitle?: string;
subtitle?: React.ReactNode;
/** Optional link below subtitle */
linkProps?: PageHeaderLinkProps;
/** Optional icon for content header (appears to the left of the content header's title with a divider) */
Expand All @@ -49,7 +49,7 @@ const useStyles = createUseStyles({

export const ContentHeader: React.FunctionComponent<React.PropsWithChildren<ContentHeaderProps>> = ({
title,
subtitle,
subtitle = null,
linkProps,
icon,
label,
Expand Down Expand Up @@ -81,9 +81,11 @@ export const ContentHeader: React.FunctionComponent<React.PropsWithChildren<Cont
<FlexItem flex={{ default: 'flex_1' }}>
<Split hasGutter>
<SplitItem>
<Content className="pf-v6-u-mb-sm" component="h1" ouiaId={`${ouiaId}-title`}>
{title}
</Content>
{typeof title === 'string' ? (
<Content className="pf-v6-u-mb-sm" component="h1" ouiaId={`${ouiaId}-title`}>
{title}
</Content>
) : title}
</SplitItem>
{label && (
<SplitItem>
Expand All @@ -97,11 +99,11 @@ export const ContentHeader: React.FunctionComponent<React.PropsWithChildren<Cont
</SplitItem>
)}
</Split>
{subtitle && (
{typeof subtitle === 'string' ? (
<Content component="p" ouiaId={`${ouiaId}-subtitle`}>
{subtitle}
</Content>
)}
) : subtitle}
{linkProps && (
<Button variant={ButtonVariant.link} component="a" ouiaId={`${ouiaId}-link-button`} isInline icon={isExternal ? <ExternalLinkAltIcon className='pf-v6-u-ml-sm' /> : null} iconPosition="end" {...linkRestProps}>
{linkProps.label}
Expand All @@ -110,6 +112,7 @@ export const ContentHeader: React.FunctionComponent<React.PropsWithChildren<Cont
</FlexItem>
</Flex>
</PageSection>
)};
);
};

export default ContentHeader;
Loading