mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-07 21:54:53 +03:00
BDEVEXP-1740
* Added feature to have 'Additional Doc' as an option. * Added feature to determine whether the api 'isOt2'. * updated version number to 20.2.3 and bundled.
This commit is contained in:
parent
50cd4a3902
commit
a058429b45
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "otx-redoc",
|
"name": "otx-redoc",
|
||||||
"version": "20.2.2",
|
"version": "20.2.3",
|
||||||
"description": "ReDoc",
|
"description": "ReDoc",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { OpenAPIInfo } from '../../types';
|
|
||||||
import { ApiBackToText } from './styled.elements';
|
import { ApiBackToText } from './styled.elements';
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class ApiBackTo extends React.Component<{ info: OpenAPIInfo }> {
|
export class ApiBackTo extends React.Component<{ isOt2: boolean }> {
|
||||||
state = {
|
state = {
|
||||||
backTextColor: '#0084CE'
|
backTextColor: '#0084CE'
|
||||||
};
|
};
|
||||||
|
@ -13,9 +12,10 @@ export class ApiBackTo extends React.Component<{ info: OpenAPIInfo }> {
|
||||||
handleActiveState = () => {this.setState({backTextColor: '#00639B'})};
|
handleActiveState = () => {this.setState({backTextColor: '#00639B'})};
|
||||||
handleLeaveState = () => {this.setState({backTextColor: '#0084CE'})};
|
handleLeaveState = () => {this.setState({backTextColor: '#0084CE'})};
|
||||||
render() {
|
render() {
|
||||||
|
const { isOt2 } = this.props;
|
||||||
return(
|
return(
|
||||||
<div>
|
<div>
|
||||||
<ApiBackToText href={'/apis'}
|
<ApiBackToText href={isOt2?'/apis': '/apis/other'}
|
||||||
onMouseEnter={this.handleHoverState}
|
onMouseEnter={this.handleHoverState}
|
||||||
onMouseDown={this.handleActiveState}
|
onMouseDown={this.handleActiveState}
|
||||||
onMouseLeave={this.handleLeaveState}>
|
onMouseLeave={this.handleLeaveState}>
|
||||||
|
|
|
@ -80,16 +80,17 @@ export class ApiInfo extends React.Component<ApiInfoProps> {
|
||||||
null;
|
null;
|
||||||
|
|
||||||
const version = (info.version && <span>({info.version})</span>) || null;
|
const version = (info.version && <span>({info.version})</span>) || null;
|
||||||
|
const hasAdditionalDoc = store.options.hasAdditionalDoc;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Section>
|
<Section>
|
||||||
<Row>
|
<Row>
|
||||||
<MiddlePanel className="api-info">
|
<MiddlePanel className="api-info">
|
||||||
<ApiHeader>
|
<ApiHeader>
|
||||||
<div style={{width: '60%', color: '#111B58', fontWeight: 500}}>
|
<div style={{width: hasAdditionalDoc? '60%':'', color: '#111B58', fontWeight: 500}}>
|
||||||
{info.title} {version}
|
{info.title} {version}
|
||||||
</div>
|
</div>
|
||||||
<div style={{margin: '0 auto'}}
|
{hasAdditionalDoc? <div style={{margin: '0 auto'}}
|
||||||
onMouseEnter={this.handleHoverState}
|
onMouseEnter={this.handleHoverState}
|
||||||
onMouseDown={this.handleActiveState}
|
onMouseDown={this.handleActiveState}
|
||||||
onMouseLeave={this.handleLeaveState}>
|
onMouseLeave={this.handleLeaveState}>
|
||||||
|
@ -109,7 +110,7 @@ export class ApiInfo extends React.Component<ApiInfoProps> {
|
||||||
Additional Docs
|
Additional Docs
|
||||||
</span>
|
</span>
|
||||||
</AdditionalDocLink>
|
</AdditionalDocLink>
|
||||||
</div>
|
</div>:null}
|
||||||
</ApiHeader>
|
</ApiHeader>
|
||||||
{!hideDownloadButton && (
|
{!hideDownloadButton && (
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -34,7 +34,7 @@ export class Redoc extends React.Component<RedocProps> {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
store: { spec, menu, options, search, marker },
|
store: {menu, options, search, marker },
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const store = this.props.store;
|
const store = this.props.store;
|
||||||
return (
|
return (
|
||||||
|
@ -43,7 +43,7 @@ export class Redoc extends React.Component<RedocProps> {
|
||||||
<OptionsProvider value={options}>
|
<OptionsProvider value={options}>
|
||||||
<RedocWrap className="redoc-wrap">
|
<RedocWrap className="redoc-wrap">
|
||||||
<StickyResponsiveSidebar menu={menu} className="menu-content">
|
<StickyResponsiveSidebar menu={menu} className="menu-content">
|
||||||
<ApiBackTo info={spec.info} />
|
<ApiBackTo isOt2={options.isOt2} />
|
||||||
{(!options.disableSearch && (
|
{(!options.disableSearch && (
|
||||||
<SearchBox
|
<SearchBox
|
||||||
search={search!}
|
search={search!}
|
||||||
|
|
|
@ -21,6 +21,8 @@ export interface RedocRawOptions {
|
||||||
disableSearch?: boolean | string;
|
disableSearch?: boolean | string;
|
||||||
onlyRequiredInSamples?: boolean | string;
|
onlyRequiredInSamples?: boolean | string;
|
||||||
showExtensions?: boolean | string | string[];
|
showExtensions?: boolean | string | string[];
|
||||||
|
isOt2?: boolean;
|
||||||
|
hasAdditionalDoc?: boolean;
|
||||||
additionalDocUrl?: string;
|
additionalDocUrl?: string;
|
||||||
hideSingleRequestSampleTab?: boolean | string;
|
hideSingleRequestSampleTab?: boolean | string;
|
||||||
menuToggle?: boolean | string;
|
menuToggle?: boolean | string;
|
||||||
|
@ -165,6 +167,8 @@ export class RedocNormalizedOptions {
|
||||||
disableSearch: boolean;
|
disableSearch: boolean;
|
||||||
onlyRequiredInSamples: boolean;
|
onlyRequiredInSamples: boolean;
|
||||||
showExtensions: boolean | string[];
|
showExtensions: boolean | string[];
|
||||||
|
isOt2: boolean;
|
||||||
|
hasAdditionalDoc: boolean;
|
||||||
additionalDocUrl: string | undefined;
|
additionalDocUrl: string | undefined;
|
||||||
hideSingleRequestSampleTab: boolean;
|
hideSingleRequestSampleTab: boolean;
|
||||||
menuToggle: boolean;
|
menuToggle: boolean;
|
||||||
|
@ -205,6 +209,8 @@ export class RedocNormalizedOptions {
|
||||||
this.disableSearch = argValueToBoolean(raw.disableSearch);
|
this.disableSearch = argValueToBoolean(raw.disableSearch);
|
||||||
this.onlyRequiredInSamples = argValueToBoolean(raw.onlyRequiredInSamples);
|
this.onlyRequiredInSamples = argValueToBoolean(raw.onlyRequiredInSamples);
|
||||||
this.showExtensions = RedocNormalizedOptions.normalizeShowExtensions(raw.showExtensions);
|
this.showExtensions = RedocNormalizedOptions.normalizeShowExtensions(raw.showExtensions);
|
||||||
|
this.isOt2 = argValueToBoolean(raw.isOt2);
|
||||||
|
this.hasAdditionalDoc = argValueToBoolean(raw.hasAdditionalDoc);
|
||||||
this.additionalDocUrl = argValueToString(raw.additionalDocUrl);
|
this.additionalDocUrl = argValueToString(raw.additionalDocUrl);
|
||||||
this.hideSingleRequestSampleTab = argValueToBoolean(raw.hideSingleRequestSampleTab);
|
this.hideSingleRequestSampleTab = argValueToBoolean(raw.hideSingleRequestSampleTab);
|
||||||
this.menuToggle = argValueToBoolean(raw.menuToggle, true);
|
this.menuToggle = argValueToBoolean(raw.menuToggle, true);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user