31 lines
846 B
TypeScript
31 lines
846 B
TypeScript
import { ReactNode } from 'react';
|
|
|
|
interface PageHeaderProps {
|
|
title: string;
|
|
description?: string;
|
|
actions?: ReactNode;
|
|
}
|
|
|
|
/**
|
|
* Consistent page header for dashboard pages.
|
|
* Mobile: actions appear above title (right-aligned).
|
|
* Desktop: title on the left, actions on the right.
|
|
*/
|
|
export function PageHeader({ title, description, actions }: PageHeaderProps) {
|
|
return (
|
|
<div className="flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between">
|
|
{actions && (
|
|
<div className="flex items-center justify-end gap-2 sm:order-last">
|
|
{actions}
|
|
</div>
|
|
)}
|
|
<div>
|
|
<h1 className="text-xl sm:text-2xl font-bold text-gray-900">{title}</h1>
|
|
{description && (
|
|
<p className="mt-0.5 text-sm text-gray-500">{description}</p>
|
|
)}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|