import type { ReactNode } from "react"; import Link from "next/link"; import { ChevronRightIcon } from "@heroicons/react/24/outline"; import { Skeleton } from "@/components/atoms/loading-skeleton"; import { ErrorState } from "@/components/atoms/error-state"; export interface BreadcrumbItem { label: string; href?: string; } interface PageLayoutProps { icon?: ReactNode; title: string; description?: string; actions?: ReactNode; breadcrumbs?: BreadcrumbItem[]; loading?: boolean; error?: Error | string | null; onRetry?: () => void; children: ReactNode; } export function PageLayout({ icon, title, description, actions, breadcrumbs, loading = false, error = null, onRetry, children, }: PageLayoutProps) { return (
{/* Breadcrumbs */} {breadcrumbs && breadcrumbs.length > 0 && ( )} {/* Header */}
{icon && (
{icon}
)}

{title}

{description && (

{description}

)}
{actions &&
{actions}
}
{/* Content with loading and error states */}
{loading ? ( ) : error ? ( ) : ( children )}
); } function PageLoadingState() { return (
{Array.from({ length: 3 }).map((_, i) => (
))}
); } interface PageErrorStateProps { error: Error | string; onRetry?: () => void; } function PageErrorState({ error, onRetry }: PageErrorStateProps) { const errorMessage = typeof error === "string" ? error : error.message; return (
); }