mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-08 06:04:56 +03:00
chore: clean up
This commit is contained in:
parent
0dee3a8907
commit
b90a5a000c
|
@ -101,11 +101,7 @@ export class ApiInfo extends React.Component<ApiInfoProps> {
|
||||||
null}
|
null}
|
||||||
</StyledMarkdownBlock>
|
</StyledMarkdownBlock>
|
||||||
<Markdown source={store.spec.info.description} />
|
<Markdown source={store.spec.info.description} />
|
||||||
{externalDocs && (
|
{externalDocs && <ExternalDocumentation externalDocs={externalDocs} />}
|
||||||
<p>
|
|
||||||
<ExternalDocumentation externalDocs={externalDocs} />
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
</MiddlePanel>
|
</MiddlePanel>
|
||||||
</Row>
|
</Row>
|
||||||
</Section>
|
</Section>
|
||||||
|
|
|
@ -82,9 +82,7 @@ export class SectionItem extends React.Component<ContentItemProps> {
|
||||||
{externalDocs && (
|
{externalDocs && (
|
||||||
<Row>
|
<Row>
|
||||||
<MiddlePanel>
|
<MiddlePanel>
|
||||||
<p>
|
<ExternalDocumentation externalDocs={externalDocs} />
|
||||||
<ExternalDocumentation externalDocs={externalDocs} />
|
|
||||||
</p>
|
|
||||||
</MiddlePanel>
|
</MiddlePanel>
|
||||||
</Row>
|
</Row>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -1,16 +1,18 @@
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import styled from '../../styled-components';
|
import styled, { withProps } from '../../styled-components';
|
||||||
import { OpenAPIExternalDocumentation } from '../../types';
|
import { OpenAPIExternalDocumentation } from '../../types';
|
||||||
import { linksCss } from '../Markdown/styled.elements';
|
import { linksCss } from '../Markdown/styled.elements';
|
||||||
|
|
||||||
const Link = styled.span`
|
const LinkWrap = withProps<{ compact?: boolean }>(styled.div)`
|
||||||
${linksCss};
|
${linksCss};
|
||||||
|
${({ compact }) => (!compact ? 'margin: 1em 0' : '')}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class ExternalDocumentation extends React.Component<{
|
export class ExternalDocumentation extends React.Component<{
|
||||||
externalDocs: OpenAPIExternalDocumentation;
|
externalDocs: OpenAPIExternalDocumentation;
|
||||||
|
compact?: boolean;
|
||||||
}> {
|
}> {
|
||||||
render() {
|
render() {
|
||||||
const { externalDocs } = this.props;
|
const { externalDocs } = this.props;
|
||||||
|
@ -19,9 +21,9 @@ export class ExternalDocumentation extends React.Component<{
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link>
|
<LinkWrap compact={this.props.compact}>
|
||||||
<a href={externalDocs.url}>{externalDocs.description || externalDocs.url}</a>
|
<a href={externalDocs.url}>{externalDocs.description || externalDocs.url}</a>
|
||||||
</Link>
|
</LinkWrap>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,9 +55,7 @@ export class FieldDetails extends React.PureComponent<FieldProps> {
|
||||||
<Markdown dense={true} source={description} />
|
<Markdown dense={true} source={description} />
|
||||||
</div>
|
</div>
|
||||||
{schema.externalDocs && (
|
{schema.externalDocs && (
|
||||||
<div>
|
<ExternalDocumentation externalDocs={schema.externalDocs} compact={true} />
|
||||||
<ExternalDocumentation externalDocs={schema.externalDocs} />
|
|
||||||
</div>
|
|
||||||
)}
|
)}
|
||||||
{(renderDiscriminatorSwitch && renderDiscriminatorSwitch(this.props)) || null}
|
{(renderDiscriminatorSwitch && renderDiscriminatorSwitch(this.props)) || null}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -26,7 +26,7 @@ const OperationRow = styled(Row)`
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const Description = styled(Markdown)`
|
const Description = styled.div`
|
||||||
margin-bottom: ${({ theme }) => theme.spacing.unit * 6}px;
|
margin-bottom: ${({ theme }) => theme.spacing.unit * 6}px;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@ -40,6 +40,8 @@ export class Operation extends React.Component<OperationProps> {
|
||||||
const { operation } = this.props;
|
const { operation } = this.props;
|
||||||
|
|
||||||
const { name: summary, description, deprecated, externalDocs } = operation;
|
const { name: summary, description, deprecated, externalDocs } = operation;
|
||||||
|
const hasDescription = !!(description || externalDocs);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<OptionsContext.Consumer>
|
<OptionsContext.Consumer>
|
||||||
{options => (
|
{options => (
|
||||||
|
@ -50,11 +52,11 @@ export class Operation extends React.Component<OperationProps> {
|
||||||
{summary} {deprecated && <Badge type="warning"> Deprecated </Badge>}
|
{summary} {deprecated && <Badge type="warning"> Deprecated </Badge>}
|
||||||
</H2>
|
</H2>
|
||||||
{options.pathInMiddlePanel && <Endpoint operation={operation} inverted={true} />}
|
{options.pathInMiddlePanel && <Endpoint operation={operation} inverted={true} />}
|
||||||
{description !== undefined && <Description source={description} />}
|
{hasDescription && (
|
||||||
{externalDocs && (
|
<Description>
|
||||||
<p>
|
{description !== undefined && <Markdown source={description} />}
|
||||||
<ExternalDocumentation externalDocs={externalDocs} />
|
{externalDocs && <ExternalDocumentation externalDocs={externalDocs} />}
|
||||||
</p>
|
</Description>
|
||||||
)}
|
)}
|
||||||
<SecurityRequirements securities={operation.security} />
|
<SecurityRequirements securities={operation.security} />
|
||||||
<Parameters parameters={operation.parameters} body={operation.requestBody} />
|
<Parameters parameters={operation.parameters} body={operation.requestBody} />
|
||||||
|
|
Loading…
Reference in New Issue
Block a user