import { ReactNode } from 'react'; import clsx from 'clsx'; import { InlineLoader } from '@@/InlineLoader'; import { Alert } from '@@/Alert'; import { Widget } from '@@/Widget'; interface Props { isLoading: boolean; errorMessage?: string; icon: ReactNode; iconBackgroundClassName?: string; subtitleLabel?: string; subtitleClassName?: string; title: string; badge?: ReactNode; description?: ReactNode; rightInfo?: ReactNode; actionBar?: ReactNode; containerClassName?: string; widgetClassName?: string; } export function ResourceDetailHeader({ 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, actionBar, containerClassName = 'flex items-center gap-4 p-6', widgetClassName = 'widget-body', }: Props) { if (isLoading) { return (
Loading details...
); } if (errorMessage) { return (
{errorMessage}
); } return (
{rightInfo}
{actionBar}
); } interface HeaderIconProps { icon: ReactNode; iconBackgroundClassName: string; } function HeaderIcon({ icon, iconBackgroundClassName }: HeaderIconProps) { return (
{icon}
); } interface HeaderInfoProps { subtitleLabel?: string; subtitleClassName: string; title: string; badge?: ReactNode; description?: ReactNode; } function HeaderInfo({ subtitleLabel, subtitleClassName, title, badge, description, }: HeaderInfoProps) { return (
{subtitleLabel && ( {subtitleLabel} )}

{title}

{badge &&
{badge}
}
{description && {description}}
); }