/** * BaseWidget - Wrapper component for all widgets * Provides consistent styling, controls, and error/loading states */ import type { ReactNode } from "react"; import { Settings, X } from "lucide-react"; // Simple classnames utility function cn(...classes: (string | undefined | null | false)[]): string { return classes.filter(Boolean).join(" "); } export interface BaseWidgetProps { id: string; title: string; description?: string; children: ReactNode; onEdit?: () => void; onRemove?: () => void; className?: string; isLoading?: boolean; error?: string; } export function BaseWidget({ id, title, description, children, onEdit, onRemove, className, isLoading = false, error, }: BaseWidgetProps): React.JSX.Element { return (
{/* Widget Header */}

{title}

{description && (

{description}

)}
{/* Control buttons - only show if handlers provided */} {(onEdit ?? onRemove) && (
{onEdit && ( )} {onRemove && ( )}
)}
{/* Widget Content */}
{isLoading ? (
Loading...
) : error ? (
Error
{error}
) : ( children )}
); }