import * as React from 'react' import { cn } from '../core/cn' interface DetailField { label: string value: React.ReactNode span?: 1 | 2 } interface DetailTab { label: string value: string content: React.ReactNode count?: number } interface TimelineEvent { id: string title: string description?: string timestamp: string icon?: React.ReactNode variant?: 'default' | 'success' | 'warning' | 'error' } interface DetailPageProps { title: string subtitle?: string badge?: React.ReactNode avatar?: React.ReactNode actions?: React.ReactNode onBack?: () => void fields: DetailField[] tabs?: DetailTab[] activeTab?: string onTabChange?: (value: string) => void timeline?: TimelineEvent[] className?: string } const variantDotColors = { default: 'bg-primary', success: 'bg-green-500', warning: 'bg-amber-500', error: 'bg-red-500', } export function detailPage({ title, subtitle, badge, avatar, actions, onBack, fields, tabs, activeTab, onTabChange, timeline, className, }: DetailPageProps): React.ReactElement { return (
{/* Header */}
{onBack && ( )} {avatar &&
{avatar}
}

{title}

{badge}
{subtitle &&

{subtitle}

}
{actions &&
{actions}
}
{/* Fields grid */}
{fields.map((field, i) => (

{field.label}

{field.value}
))}
{/* Tabs */} {tabs && tabs.length > 0 && (
{tabs.find(t => t.value === activeTab)?.content}
)} {/* Timeline */} {timeline && timeline.length > 0 && (

Activity

{timeline.map((event, i) => (
{i < timeline.length - 1 &&
}

{event.title}

{event.description &&

{event.description}

}

{event.timestamp}

))}
)}
) } export type { DetailPageProps, DetailField, DetailTab, TimelineEvent }