Page Header: do not add markup if the prop is not passed in

This commit is contained in:
gbuomprisco
2024-09-20 20:41:45 +02:00
parent 85c1f35631
commit 9f5c2f57b0

View File

@@ -1,6 +1,7 @@
import * as React from 'react';
import { cn } from '../lib/utils';
import { If } from './if';
export type PageLayoutStyle = 'sidebar' | 'header' | 'custom';
@@ -108,7 +109,7 @@ export function PageBody(
className?: string;
}>,
) {
const className = cn('w-full flex flex-col flex-1 lg:px-4', props.className);
const className = cn('flex w-full flex-1 flex-col lg:px-4', props.className);
return <div className={className}>{props.children}</div>;
}
@@ -161,8 +162,13 @@ export function PageHeader({
)}
>
<div className={'flex flex-col'}>
<PageDescription>{description}</PageDescription>
<PageTitle>{title}</PageTitle>
<If condition={description}>
<PageDescription>{description}</PageDescription>
</If>
<If condition={title}>
<PageTitle>{title}</PageTitle>
</If>
</div>
{children}