Fix ErrorModal title

Co-authored-by: ayumi-signal <143036029+ayumi-signal@users.noreply.github.com>
This commit is contained in:
automated-signal 2024-10-16 12:36:39 -05:00 committed by GitHub
parent 173a7b729a
commit ee1e15646b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 2 deletions

View file

@ -17,7 +17,7 @@ const i18n = setupI18n('en', enMessages);
const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
buttonVariant: overrideProps.buttonVariant ?? undefined,
description: overrideProps.description ?? '',
title: overrideProps.title ?? '',
title: Object.hasOwn(overrideProps, 'title') ? overrideProps.title : '',
i18n,
onClose: action('onClick'),
});
@ -48,3 +48,14 @@ export function CustomStrings(): JSX.Element {
/>
);
}
export function NoTitle(): JSX.Element {
return (
<ErrorModal
{...createProps({
title: null,
description: 'This is a fun error!',
})}
/>
);
}

View file

@ -40,7 +40,7 @@ export function ErrorModal(props: PropsType): JSX.Element {
modalName="ErrorModal"
i18n={i18n}
onClose={onClose}
title={title == null ? undefined : i18n('icu:ErrorModal--title')}
title={title == null ? undefined : title || i18n('icu:ErrorModal--title')}
modalFooter={footer}
>
<div className="module-error-modal__description">