import React from 'react'; import { CloudProviderRegistry } from './CloudProviderRegistry'; import { Tooltip } from '../presentation/Tooltip'; import './cloudProviderLogo.less'; export interface ICloudProviderLogoProps { provider: string; height: string; width: string; showTooltip?: boolean; } export const CloudProviderLogo = ({ height, provider, showTooltip, width }: ICloudProviderLogoProps) => { const [tooltip, setTooltip] = React.useState(undefined); const RegistryLogo = CloudProviderRegistry.getValue(provider, 'cloudProviderLogo'); React.useEffect(() => { if (showTooltip) { setTooltip(CloudProviderRegistry.getValue(provider, 'name') || provider); } }, [showTooltip]); const ProviderLogo = RegistryLogo ? ( ) : ( ); if (tooltip) { return {ProviderLogo}; } return {ProviderLogo}; };