29 lines
759 B
TypeScript
29 lines
759 B
TypeScript
import { cn } from '@/lib/cn'
|
|
|
|
interface Props {
|
|
title: string
|
|
subtitle?: string
|
|
/** 标题右侧、subtitle 之前的额外节点(如状态徽标) */
|
|
titleExtra?: React.ReactNode
|
|
right?: React.ReactNode
|
|
className?: string
|
|
}
|
|
|
|
export function PageHeader({ title, subtitle, titleExtra, right, className }: Props) {
|
|
return (
|
|
<header
|
|
className={cn(
|
|
'px-5 pt-3 pb-2 border-b border-border flex items-center justify-between gap-4',
|
|
className,
|
|
)}
|
|
>
|
|
<div className="flex items-center gap-2">
|
|
<h1 className="text-lg font-semibold tracking-tight">{title}</h1>
|
|
{titleExtra}
|
|
{subtitle && <span className="text-xs text-muted">{subtitle}</span>}
|
|
</div>
|
|
{right}
|
|
</header>
|
|
)
|
|
}
|