"use client"; import { ReactNode } from "react"; import { cn } from "@/lib/utils"; import { Button } from "@/components/ui/button"; import { LucideIcon } from "lucide-react"; interface PageTemplateProps { children: ReactNode; // Sidebar configuration sidebar?: { title?: string; description?: string; items: Array<{ title: string; icon: LucideIcon; href: string; isActive?: boolean; badge?: string | number; }>; footer?: ReactNode; customContent?: ReactNode; }; // Hero section configuration hero?: { icon?: LucideIcon; iconBgColor?: string; title: string; description?: string; actions?: Array<{ label: string; onClick: () => void; variant?: "default" | "outline" | "ghost" | "secondary"; icon?: LucideIcon; }>; }; // Container width containerWidth?: "default" | "wide" | "full"; // Custom classes className?: string; contentClassName?: string; } export function PageTemplate({ children, sidebar, hero, containerWidth = "default", className, contentClassName, }: PageTemplateProps) { const maxWidthClass = { default: "max-w-5xl", wide: "max-w-7xl", full: "max-w-none", }[containerWidth]; return (
{/* Left Sidebar Navigation (if provided) */} {sidebar && (
{/* Sidebar Header */} {sidebar.title && (

{sidebar.title}

{sidebar.description && (

{sidebar.description}

)}
)} {/* Top Div: Navigation Items */}
{sidebar.items.map((item) => { const Icon = item.icon; const isActive = item.isActive; return (
{item.title}
{item.badge && ( {item.badge} )}
); })}
{/* Divider */}
{/* Bottom Div: Custom Content */} {sidebar.customContent && (
{sidebar.customContent}
)}
)} {/* Main Content Area */}
{/* Hero Section (if provided) */} {hero && (
{hero.icon && (
)}

{hero.title}

{hero.description && (

{hero.description}

)}
{/* Hero Actions */} {hero.actions && hero.actions.length > 0 && (
{hero.actions.map((action, index) => ( ))}
)}
)} {/* Page Content */}
{children}
); } // Utility Components for common page patterns interface PageSectionProps { title?: string; description?: string; children: ReactNode; className?: string; headerAction?: ReactNode; } export function PageSection({ title, description, children, className, headerAction, }: PageSectionProps) { return (
{(title || description || headerAction) && (
{title &&

{title}

} {description && (

{description}

)}
{headerAction &&
{headerAction}
}
)} {children}
); } interface PageCardProps { children: ReactNode; className?: string; padding?: "sm" | "md" | "lg"; hover?: boolean; } export function PageCard({ children, className, padding = "md", hover = false, }: PageCardProps) { const paddingClass = { sm: "p-4", md: "p-6", lg: "p-8", }[padding]; return (
{children}
); } interface PageGridProps { children: ReactNode; cols?: 1 | 2 | 3 | 4; className?: string; } export function PageGrid({ children, cols = 2, className }: PageGridProps) { const colsClass = { 1: "grid-cols-1", 2: "md:grid-cols-2", 3: "md:grid-cols-3", 4: "md:grid-cols-2 lg:grid-cols-4", }[cols]; return (
{children}
); } interface PageEmptyStateProps { icon: LucideIcon; title: string; description?: string; action?: { label: string; onClick: () => void; icon?: LucideIcon; }; } export function PageEmptyState({ icon: Icon, title, description, action, }: PageEmptyStateProps) { return (

{title}

{description && (

{description}

)} {action && ( )}
); }