2025-10-19 19:04:16 +00:00
|
|
|
import { Button } from '@repo/shadcn-ui/components';
|
2025-10-06 17:40:37 +00:00
|
|
|
import { cn } from '@repo/shadcn-ui/lib/utils';
|
2025-10-19 19:04:16 +00:00
|
|
|
import { ChevronLeftIcon } from 'lucide-react';
|
2025-09-29 18:22:59 +00:00
|
|
|
// features/common/components/page-header.tsx
|
|
|
|
|
import type { ReactNode } from "react";
|
|
|
|
|
import { CustomerInvoiceStatusBadge } from "./customer-invoice-status-badge";
|
|
|
|
|
|
|
|
|
|
interface PageHeaderProps {
|
|
|
|
|
/** Icono que aparece a la izquierda del título */
|
|
|
|
|
icon?: ReactNode;
|
|
|
|
|
/** Contenido del título (texto plano o nodo complejo) */
|
|
|
|
|
title: ReactNode;
|
|
|
|
|
/** Descripción secundaria debajo del título */
|
|
|
|
|
description?: ReactNode;
|
|
|
|
|
/** Estado opcional (ej. "draft", "paid") */
|
|
|
|
|
status?: string;
|
|
|
|
|
/** Contenido del lado derecho (botones, menús, etc.) */
|
|
|
|
|
rightSlot?: ReactNode;
|
2025-10-06 17:40:37 +00:00
|
|
|
|
|
|
|
|
className?: string;
|
2025-09-29 18:22:59 +00:00
|
|
|
}
|
|
|
|
|
|
2025-10-06 17:40:37 +00:00
|
|
|
export function PageHeader({ icon, title, description, status, rightSlot, className }: PageHeaderProps) {
|
2025-09-29 18:22:59 +00:00
|
|
|
return (
|
2025-10-19 19:04:16 +00:00
|
|
|
<div className={cn("border-b bg-card -px-4 pt-4", className)}>
|
|
|
|
|
<div className="mx-auto px-6 py-4">
|
2025-09-29 18:22:59 +00:00
|
|
|
<div className='flex items-center justify-between'>
|
|
|
|
|
{/* Lado izquierdo */}
|
2025-10-19 19:04:16 +00:00
|
|
|
<div className='flex items-center gap-4'>
|
|
|
|
|
<Button variant="ghost" size="icon" className="cursor-pointer" onClick={() => window.history.back()}>
|
|
|
|
|
<ChevronLeftIcon className="size-5" />
|
|
|
|
|
</Button>
|
2025-09-29 18:22:59 +00:00
|
|
|
{icon && <div className='shrink-0'>{icon}</div>}
|
2025-10-19 19:04:16 +00:00
|
|
|
|
2025-09-29 18:22:59 +00:00
|
|
|
<div>
|
|
|
|
|
<div className='flex items-center gap-3'>
|
2025-10-19 19:04:16 +00:00
|
|
|
<h1 className='text-xl font-semibold text-foreground'>{title}</h1>
|
2025-09-29 18:22:59 +00:00
|
|
|
{status && <CustomerInvoiceStatusBadge status={status} />}
|
|
|
|
|
</div>
|
|
|
|
|
{description && <p className='text-sm text-muted-foreground'>{description}</p>}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Lado derecho parametrizable */}
|
|
|
|
|
{rightSlot && <div>{rightSlot}</div>}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|