diff --git a/package.json b/package.json index 6ed44f32..b8dc6aae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "otx-redoc", - "version": "20.1.3", + "version": "20.1.4", "description": "ReDoc", "repository": { "type": "git", diff --git a/src/components/ApiInfo/ApiInfo.tsx b/src/components/ApiInfo/ApiInfo.tsx index f222f343..ea08e4f4 100644 --- a/src/components/ApiInfo/ApiInfo.tsx +++ b/src/components/ApiInfo/ApiInfo.tsx @@ -8,6 +8,7 @@ import { ExternalDocumentation } from '../ExternalDocumentation/ExternalDocument import { Markdown } from '../Markdown/Markdown'; import { StyledMarkdownBlock } from '../Markdown/styled.elements'; import { + AdditionalDocLink, ApiHeader, DownloadButton, InfoSpan, @@ -76,6 +77,18 @@ export class ApiInfo extends React.Component { {info.title} {version} + + + + + + + + Additional Docs + {!hideDownloadButton && (

diff --git a/src/components/ApiInfo/styled.elements.ts b/src/components/ApiInfo/styled.elements.ts index 72bebcd4..4621b07c 100644 --- a/src/components/ApiInfo/styled.elements.ts +++ b/src/components/ApiInfo/styled.elements.ts @@ -12,6 +12,12 @@ export const ApiHeader = styled(H1)` ${extensionsHook('ApiHeader')}; `; +export const AdditionalDocLink = styled.a` + padding-left: 100px; + font-size: 16px; + color: #0084CE; +`; + export const DownloadButton = styled.a` border: 1px solid ${props => props.theme.colors.primary.main}; color: ${props => props.theme.colors.primary.main}; diff --git a/src/services/RedocNormalizedOptions.ts b/src/services/RedocNormalizedOptions.ts index 282f4eb1..6a528547 100644 --- a/src/services/RedocNormalizedOptions.ts +++ b/src/services/RedocNormalizedOptions.ts @@ -21,6 +21,7 @@ export interface RedocRawOptions { disableSearch?: boolean | string; onlyRequiredInSamples?: boolean | string; showExtensions?: boolean | string | string[]; + additionalDocUrl?: string; hideSingleRequestSampleTab?: boolean | string; menuToggle?: boolean | string; jsonSampleExpandLevel?: number | string | 'all'; @@ -49,6 +50,15 @@ function argValueToBoolean(val?: string | boolean, defaultValue?: boolean): bool return val; } +function argValueToString(val?: string | undefined, defaultValue?: string): string | undefined { + if (val === undefined) { + return defaultValue || ''; + } + if (typeof val === 'string') { + return val; + } +} + export class RedocNormalizedOptions { static normalizeExpandResponses(value: RedocRawOptions['expandResponses']) { if (value === 'all') { @@ -155,6 +165,7 @@ export class RedocNormalizedOptions { disableSearch: boolean; onlyRequiredInSamples: boolean; showExtensions: boolean | string[]; + additionalDocUrl: string | undefined; hideSingleRequestSampleTab: boolean; menuToggle: boolean; jsonSampleExpandLevel: number; @@ -194,6 +205,7 @@ export class RedocNormalizedOptions { this.disableSearch = argValueToBoolean(raw.disableSearch); this.onlyRequiredInSamples = argValueToBoolean(raw.onlyRequiredInSamples); this.showExtensions = RedocNormalizedOptions.normalizeShowExtensions(raw.showExtensions); + this.additionalDocUrl = argValueToString(raw.additionalDocUrl); this.hideSingleRequestSampleTab = argValueToBoolean(raw.hideSingleRequestSampleTab); this.menuToggle = argValueToBoolean(raw.menuToggle, true); this.jsonSampleExpandLevel = RedocNormalizedOptions.normalizeJsonSampleExpandLevel(