From 2873b6a79aca7a885cb54631c5ca9b1f2c002778 Mon Sep 17 00:00:00 2001 From: exoego Date: Sun, 16 Sep 2018 08:36:28 +0900 Subject: [PATCH] Add feature to specify href for logo explicitly. --- docs/redoc-vendor-extensions.md | 1 + src/components/ApiLogo/ApiLogo.tsx | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/redoc-vendor-extensions.md b/docs/redoc-vendor-extensions.md index 062aec3c..c95a0461 100644 --- a/docs/redoc-vendor-extensions.md +++ b/docs/redoc-vendor-extensions.md @@ -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 | 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. +| href | string | The URL pointing to the contact page. Default to 'info.contact.url' field of the OAS. ###### x-logo example diff --git a/src/components/ApiLogo/ApiLogo.tsx b/src/components/ApiLogo/ApiLogo.tsx index 290b862d..315e478a 100644 --- a/src/components/ApiLogo/ApiLogo.tsx +++ b/src/components/ApiLogo/ApiLogo.tsx @@ -24,7 +24,10 @@ export class ApiLogo extends React.Component<{ info: OpenAPIInfo }> { ); return ( - {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 + }{' '} ); }