({ entity, className })
| 10 | } |
| 11 | |
| 12 | const EntityLogo: FC<EntityLogoProps> = ({ entity, className }) => { |
| 13 | const logoURL = getEntityLogoURL(entity); |
| 14 | const [imageError, setImageError] = useState<boolean>(false); |
| 15 | |
| 16 | const handleImageError = () => { |
| 17 | setImageError(true); |
| 18 | }; |
| 19 | |
| 20 | const handleImageLoad = () => { |
| 21 | setImageError(false); |
| 22 | }; |
| 23 | |
| 24 | return ( |
| 25 | <> |
| 26 | {imageError ? null : ( |
| 27 | <img |
| 28 | src={logoURL} |
| 29 | alt={entity} |
| 30 | className={className} |
| 31 | onError={handleImageError} |
| 32 | onLoad={handleImageLoad} |
| 33 | /> |
| 34 | )} |
| 35 | </> |
| 36 | ); |
| 37 | }; |
| 38 | |
| 39 | export default EntityLogo; |
nothing calls this directly
no test coverage detected