import React, { forwardRef } from "react"; import { BodyShort } from "../../../typography"; import { cl } from "../../../utils/helpers"; import { useI18n } from "../../../utils/i18n/i18n.hooks"; import { useBaseAlert } from "../root/BaseAlertRoot.context"; import { BaseAlertStatusIcon } from "../root/BaseAlertRoot.utils"; interface BaseAlertHeaderProps extends React.HTMLAttributes { children: React.ReactNode; /** * Icon to display in the header. */ icon?: React.ReactNode; } /** * @see 🏷️ {@link BaseAlertHeaderProps} * @example * ```jsx * * }> * Info title * * * ``` */ const BaseAlertHeader = forwardRef( ( { children, className, icon, ...restProps }: BaseAlertHeaderProps, forwardedRef, ) => { const { status, color, statusId } = useBaseAlert(); const translate = useI18n("global"); const headerIcon = icon ?? (status ? : null); return (
{headerIcon && (
{headerIcon}
)} {status && ( {`${translate(status)}: `} )} {children}
); }, ); export { BaseAlertHeader }; export type { BaseAlertHeaderProps };