1
- import React from 'react' ;
2
- import { useConfig , ArrowRightIcon } from '@openmrs/esm-framework' ;
3
- import { Tile , Button } from '@carbon/react' ;
1
+ import React , { useCallback } from 'react' ;
2
+ import { Link , Tile } from '@carbon/react' ;
4
3
import { useTranslation } from 'react-i18next' ;
4
+ import { useConfig , ArrowRightIcon } from '@openmrs/esm-framework' ;
5
5
import { type ConfigSchema } from './config-schema' ;
6
- import styles from './login/login.scss' ;
6
+ import styles from './footer.scss' ;
7
+
8
+ interface Logo {
9
+ src : string ;
10
+ alt ?: string ;
11
+ }
7
12
8
13
const Footer : React . FC = ( ) => {
9
- const { t } = useTranslation ( ) ;
14
+ const { t } = useTranslation ( ) ;
10
15
const config = useConfig < ConfigSchema > ( ) ;
11
- const logos = config . footer . additionalLogos || [ ] ;
16
+ const logos : Logo [ ] = config . footer . additionalLogos || [ ] ;
17
+
18
+ const handleImageLoadError = useCallback ( ( error : React . SyntheticEvent < HTMLImageElement , Event > ) => {
19
+ console . error ( 'Failed to load image' , error ) ;
20
+ } , [ ] ) ;
12
21
13
22
return (
14
23
< div className = { styles . footer } >
15
24
< Tile className = { styles . poweredByTile } >
16
25
< div className = { styles . poweredByContainer } >
17
26
< span className = { styles . poweredByText } > { t ( 'builtWith' , 'Built with' ) } </ span >
18
- < svg role = "img" className = { styles . poweredByLogo } >
19
- < use href = "#omrs-logo-full-color" > </ use >
20
- </ svg >
27
+ < svg aria-label = { t ( 'openmrsLogo' , 'OpenMRS Logo' ) } className = { styles . poweredByLogo } role = "img" >
28
+ < use href = "#omrs-logo-full-color" > </ use >
29
+ </ svg >
21
30
< span className = { styles . poweredByText } >
22
31
{ t ( 'poweredBySubtext' , 'An open-source medical record system and global community' ) }
23
32
</ span >
24
- < Button
25
- className = { styles . learnMore }
26
- iconDescription = { t ( 'learnMore' , 'Learn More' ) }
27
- kind = "ghost "
28
- onClick = { ( ) => window . open ( 'https://openmrs.org' , '_blank' ) }
29
- renderIcon = { ( props ) => < ArrowRightIcon { ... props } size = { 20 } className = { styles . arrowRightIcon } /> }
33
+ < Link
34
+ className = { styles . learnMoreButton }
35
+ href = "https://openmrs.org"
36
+ rel = "noopener noreferrer "
37
+ renderIcon = { ( ) => < ArrowRightIcon size = { 16 } aria-label = "Arrow right icon" /> }
38
+ target = "_blank"
30
39
>
31
- < span > { t ( 'learnMore' , 'Learn More ' ) } </ span >
32
- </ Button >
40
+ { t ( 'learnMore' , 'Learn more ' ) }
41
+ </ Link >
33
42
</ div >
34
43
</ Tile >
35
44
36
45
< div className = { styles . logosContainer } >
37
- { logos . map ( ( logo , index ) => (
46
+ { logos . map ( ( logo ) => (
38
47
< img
39
- key = { index }
40
48
alt = { logo . alt ? t ( logo . alt ) : t ( 'footerlogo' , 'Footer Logo' ) }
41
49
className = { styles . poweredByLogo }
50
+ key = { logo . src }
51
+ onError = { handleImageLoadError }
42
52
src = { logo . src }
43
53
/>
44
54
) ) }
@@ -47,4 +57,4 @@ const Footer: React.FC = () => {
47
57
) ;
48
58
} ;
49
59
50
- export default Footer ;
60
+ export default Footer ;
0 commit comments