import { ReactNode } from 'react'; import { Heading } from './Heading'; import { Text } from './Text'; export interface PanelProps { title?: string; description?: string; children: ReactNode; footer?: ReactNode; variant?: 'default' | 'muted' | 'ghost' | 'dark' | any; padding?: 'none' | 'sm' | 'md' | 'lg' | number | any; actions?: ReactNode; className?: string; style?: React.CSSProperties; border?: boolean; rounded?: string; borderColor?: string; bg?: string; } /** * Panel - Redesigned for "Modern Precision" theme. * Includes compatibility props to prevent app-wide breakage. */ export const Panel = ({ title, description, children, footer, variant = 'default', padding = 'md', actions, className, style, border, rounded, borderColor, bg, }: PanelProps) => { const variantClasses = { default: 'bg-[var(--ui-color-bg-surface)] border-[var(--ui-color-border-default)]', muted: 'bg-[var(--ui-color-bg-surface-muted)] border-[var(--ui-color-border-muted)]', ghost: 'bg-transparent border-transparent', dark: 'bg-[var(--ui-color-bg-base)] border-[var(--ui-color-border-default)]', }; const paddingClasses = { none: 'p-0', sm: 'p-2', md: 'p-4', lg: 'p-8', }; const getPaddingClass = (pad: any) => { if (typeof pad === 'string') return paddingClasses[pad as keyof typeof paddingClasses] || paddingClasses.md; return ''; // Handled in style }; const combinedStyle: React.CSSProperties = { ...style, ...(bg ? { backgroundColor: bg.startsWith('bg-') ? undefined : bg } : {}), ...(typeof padding === 'number' ? { padding: `${padding * 0.25}rem` } : {}), ...(borderColor ? { borderColor: borderColor.startsWith('border-') ? undefined : borderColor } : {}), ...(border === false ? { border: 'none' } : {}), }; return (
{(title || description || actions) && (
{title && {title}} {description && {description}}
{actions && (
{actions}
)}
)}
{children}
{footer && (
{footer}
)}
); };