import { ReactNode } from 'react'; import clsx from 'clsx'; import { Widget } from '@@/Widget'; import { Alert } from '@@/Alert'; interface Props { icon: ReactNode; iconBackgroundClassName?: string; subtitleLabel?: string; subtitleClassName?: string; title: string; badge?: ReactNode; description?: ReactNode; rightInfo?: ReactNode; actionBar?: ReactNode; isLoading?: boolean; errorMessage?: string; } export function ResourceDetailHeader({ 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, isLoading, errorMessage, }: Props) { return ( {errorMessage && ( {errorMessage} )} {!errorMessage && (
{rightInfo}
)}
{!isLoading && !errorMessage && 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}}
); }