1- import { ReactNode } from 'react' ;
2- import { useTranslation } from 'react-i18next' ;
1+ import { ReactNode , useMemo } from 'react' ;
2+ import { Trans , useTranslation } from 'react-i18next' ;
33import { Button , IllustratedMessage , Title } from '@ui5/webcomponents-react' ;
44import '@ui5/webcomponents-fiori/dist/illustrations/AllIllustrations' ;
55import { ExternalLink } from 'shared/components/ExternalLink/ExternalLink' ;
@@ -8,7 +8,7 @@ import './EmptyListComponent.scss';
88
99type EmptyListComponentProps = {
1010 titleText : string ;
11- subtitleText : string ;
11+ subtitleText : string | ReactNode ;
1212 showButton ?: boolean ;
1313 buttonText ?: string ;
1414 url : string ;
@@ -29,6 +29,19 @@ export const EmptyListComponent = ({
2929} : EmptyListComponentProps ) => {
3030 const { t } = useTranslation ( ) ;
3131
32+ const subtitle = useMemo ( ( ) => {
33+ if ( ! subtitleText ) return '' ;
34+ if ( typeof subtitleText !== 'string' ) return subtitleText ;
35+
36+ return (
37+ < Trans
38+ i18nKey = { subtitleText }
39+ defaults = { subtitleText }
40+ components = { [ < ExternalLink key = { subtitleText } url = { url } /> ] }
41+ />
42+ ) ;
43+ } , [ subtitleText , url ] ) ;
44+
3245 if ( showButton === undefined ) {
3346 showButton = typeof onClick === 'function' ;
3447 }
@@ -48,9 +61,7 @@ export const EmptyListComponent = ({
4861 { titleText }
4962 </ Title >
5063 }
51- subtitle = {
52- < span className = "sap-margin-top-small" > { subtitleText ?? '' } </ span >
53- }
64+ subtitle = { < span className = "sap-margin-top-small" > { subtitle } </ span > }
5465 >
5566 < div className = "emptyListComponent__buttons" >
5667 { showButton && < Button onClick = { onClick } > { buttonText } </ Button > }
0 commit comments