Page Header: do not add markup if the prop is not passed in
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import { cn } from '../lib/utils';
|
import { cn } from '../lib/utils';
|
||||||
|
import { If } from './if';
|
||||||
|
|
||||||
export type PageLayoutStyle = 'sidebar' | 'header' | 'custom';
|
export type PageLayoutStyle = 'sidebar' | 'header' | 'custom';
|
||||||
|
|
||||||
@@ -108,7 +109,7 @@ export function PageBody(
|
|||||||
className?: string;
|
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>;
|
return <div className={className}>{props.children}</div>;
|
||||||
}
|
}
|
||||||
@@ -161,8 +162,13 @@ export function PageHeader({
|
|||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<div className={'flex flex-col'}>
|
<div className={'flex flex-col'}>
|
||||||
|
<If condition={description}>
|
||||||
<PageDescription>{description}</PageDescription>
|
<PageDescription>{description}</PageDescription>
|
||||||
|
</If>
|
||||||
|
|
||||||
|
<If condition={title}>
|
||||||
<PageTitle>{title}</PageTitle>
|
<PageTitle>{title}</PageTitle>
|
||||||
|
</If>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
Reference in New Issue
Block a user