Add feature to specify href for logo explicitly.

This commit is contained in:
exoego 2018-09-16 08:36:28 +09:00
parent ab98ab0cb2
commit 2873b6a79a
2 changed files with 5 additions and 1 deletions

View File

@ -96,6 +96,7 @@ The information about API logo
| url | string | The URL pointing to the spec logo. MUST be in the format of a URL. It SHOULD be an absolute URL so your API definition is usable from any location | url | string | The URL pointing to the spec logo. MUST be in the format of a URL. It SHOULD be an absolute URL so your API definition is usable from any location
| backgroundColor | string | background color to be used. MUST be RGB color in [hexadecimal format] (https://en.wikipedia.org/wiki/Web_colors#Hex_triplet) | backgroundColor | string | background color to be used. MUST be RGB color in [hexadecimal format] (https://en.wikipedia.org/wiki/Web_colors#Hex_triplet)
| altText | string | Text to use for alt tag on the logo. Defaults to 'logo' if nothing is provided. | altText | string | Text to use for alt tag on the logo. Defaults to 'logo' if nothing is provided.
| href | string | The URL pointing to the contact page. Default to 'info.contact.url' field of the OAS.
###### x-logo example ###### x-logo example

View File

@ -24,7 +24,10 @@ export class ApiLogo extends React.Component<{ info: OpenAPIInfo }> {
); );
return ( return (
<LogoWrap> <LogoWrap>
{info.contact && info.contact.url ? LinkWrap(info.contact.url)(logo) : logo}{' '} {
logoInfo.href ? LinkWrap(logoInfo.href)(logo) :
info.contact && info.contact.url ? LinkWrap(info.contact.url)(logo) : logo
}{' '}
</LogoWrap> </LogoWrap>
); );
} }