import { ReactNode } from 'react'; import clsx from 'clsx'; import { InlineLoader } from '@@/InlineLoader'; import { Alert } from '@@/Alert'; import { Widget } from '@@/Widget'; interface Props { // Data states isLoading: boolean; errorMessage?: string; // Icon section icon: ReactNode; iconBackgroundClassName?: string; // Header section subtitleLabel?: string; subtitleClassName?: string; title: string; badge?: ReactNode; description?: ReactNode; // Right side info rightInfo?: ReactNode; // Customization containerClassName?: string; widgetClassName?: string; } export function HeaderLayout({ isLoading, errorMessage, icon, iconBackgroundClassName = 'bg-group-accent-3 th-dark:bg-group-accent-10', subtitleLabel, subtitleClassName = 'text-group-accent-10 th-dark:text-group-accent-8', title, badge, description, rightInfo, containerClassName = 'flex items-center gap-4 p-4', widgetClassName = '!border border-solid border-gray-4 th-dark:border-widget th-highcontrast:border-gray-11', }: Props) { if (isLoading) { return (
Loading details...
); } if (errorMessage) { return (
{errorMessage}
); } return (
{/* Icon container */}
{icon}
{/* Header info */}
{subtitleLabel && (
{subtitleLabel}
)}
{title} {badge &&
{badge}
}
{description && ( {description} )}
{/* Right-side info */} {rightInfo && (
{rightInfo}
)}
); }