import { EuiIcon } from '@elastic/eui' ; import React , { useEffect , useState } from 'react' ; import { getPlatformIconModule } from './helpers' ; export interface PlatformIconProps { platform : string ; } const PlatformIconComponent = ( { platform } ) => { const [ Icon , setIcon ] = useState < React . ReactElement | null > ( null ) ; useEffect ( ( ) => { const interval = setInterval ( ( ) => { const platformIconModule = getPlatformIconModule ( platform ) ; setIcon ( < EuiIcon type = { platformIconModule } title = { platform } size = "l" / > ) ; } , 0 ) ; return ( ) => clearInterval ( interval ) ; } , [ platform , setIcon ] ) ; return Icon ; } ; export const PlatformIcon = React . memo ( PlatformIconComponent ) ;