import * as React from 'react'; import { ChevronLeft } from 'lucide-react'; import { cn } from '../../shared/utils'; import { Button } from '../button'; /** * Props for the PageHeader component. */ export interface PageHeaderProps { /** Main title of the page */ title: string; /** Optional subtitle or description */ subtitle?: string; /** Optional URL for the back button (renders a native ``). */ backHref?: string; /** Optional click handler for the back button. */ onBack?: () => void; /** * Custom back link renderer — use this for SPA router links (React Router, Next.js, etc.) * so the navigation does not trigger a full page reload. * * @example * // React Router * renderBackLink={(icon) => {icon}} * // Next.js * renderBackLink={(icon) => {icon}} */ renderBackLink?: (icon: React.ReactNode) => React.ReactElement; /** Action buttons or elements to display on the right */ actions?: React.ReactNode; /** Additional CSS classes */ className?: string; /** Accessible label for the back button. @default "Back" */ backLabel?: string; } /** * Standard Header for individual pages or sections. * * @description * Use this component at the top of your page content to provide a consistent * title, optional subtitle, navigation (back button), and primary actions. * * @ai-rules * 1. Use `title` for the primary H1-level descriptor of the page. * 2. Prefer `renderBackLink` over `backHref` in SPA projects (React Router, Next.js) to avoid full reloads. * 3. Use `actions` for buttons like "Save", "Create", or secondary dropdowns. */ export function PageHeader({ title, subtitle, backHref, onBack, renderBackLink, actions, className, backLabel = 'Back', }: PageHeaderProps) { const showBack = !!(backHref || onBack || renderBackLink); const icon = ; return (
{showBack && ( )}

{title}

{subtitle &&

{subtitle}

}
{actions &&
{actions}
}
); } /** * Styled Heading for custom page headers. */ export function PageHeaderHeading({ className, ...props }: React.HTMLAttributes) { return (

); } /** * Styled Description for custom page headers. */ export function PageHeaderDescription({ className, ...props }: React.HTMLAttributes) { return

; }