simplify logoHref

This commit is contained in:
Roman Hotsiy 2018-11-27 11:26:33 +02:00 committed by GitHub
parent 2873b6a79a
commit f7e7f19165
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,6 +11,8 @@ export class ApiLogo extends React.Component<{ info: OpenAPIInfo }> {
if (!logoInfo || !logoInfo.url) { if (!logoInfo || !logoInfo.url) {
return null; return null;
} }
const logoHref = logoInfo.href || (info.contact && info.contact.url);
// Use the english word logo if no alt text is provided // Use the english word logo if no alt text is provided
const altText = logoInfo.altText ? logoInfo.altText : 'logo'; const altText = logoInfo.altText ? logoInfo.altText : 'logo';
@ -25,9 +27,8 @@ export class ApiLogo extends React.Component<{ info: OpenAPIInfo }> {
return ( return (
<LogoWrap> <LogoWrap>
{ {
logoInfo.href ? LinkWrap(logoInfo.href)(logo) : logoHref ? LinkWrap(logoHref)(logo) : logo
info.contact && info.contact.url ? LinkWrap(info.contact.url)(logo) : logo }
}{' '}
</LogoWrap> </LogoWrap>
); );
} }