import type { ReactNode } from 'react';
import { cn } from '@/lib/utils';

type Props = {
    title: string;
    description?: ReactNode;
    /** Badge affiché à côté du titre (ex. statut). */
    badge?: ReactNode;
    /** Boutons d'action alignés à droite. */
    actions?: ReactNode;
    className?: string;
};

export function PageHeader({
    title,
    description,
    badge,
    actions,
    className,
}: Props) {
    return (
        <header
            className={cn(
                'mb-6 flex flex-wrap items-start justify-between gap-4',
                className,
            )}
        >
            <div className="min-w-0 space-y-1">
                <div className="flex flex-wrap items-center gap-2">
                    <h1 className="text-2xl font-semibold tracking-tight">
                        {title}
                    </h1>
                    {badge}
                </div>
                {description && (
                    <p className="text-sm text-muted-foreground">
                        {description}
                    </p>
                )}
            </div>
            {actions && (
                <div className="flex flex-wrap items-center gap-2">
                    {actions}
                </div>
            )}
        </header>
    );
}
