mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-08 06:04:56 +03:00
Fix lint errors.
This commit is contained in:
parent
d6849fb5fa
commit
f036c414bc
|
@ -1,22 +1,21 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
|
import {Markdown} from '../components';
|
||||||
import styled from '../styled-components';
|
import styled from '../styled-components';
|
||||||
import {ShelfIcon} from "./shelfs";
|
import {ShelfIcon} from './shelfs';
|
||||||
import {Markdown} from "../components";
|
|
||||||
|
|
||||||
|
|
||||||
export interface ReadMoreProps {
|
export interface ReadMoreProps {
|
||||||
content?: string;
|
content?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ReadMoreState {
|
interface ReadMoreState {
|
||||||
open: boolean
|
open: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ReadMoreWrapper = styled.div`
|
const ReadMoreWrapper = styled.div`
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
max-height: ${(props: ReadMoreState) => props.open ? 'auto': '5em'};
|
max-height: ${(props: ReadMoreState) => props.open ? 'auto' : '5em'};
|
||||||
padding-bottom: ${(props: ReadMoreState) => props.open ? '3em' : '1em'};
|
padding-bottom: ${(props: ReadMoreState) => props.open ? '3em' : '1em'};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@ -27,7 +26,7 @@ const ReadMoreButtonBackground = styled.div`
|
||||||
background-image: linear-gradient(to bottom, rgba(255,255,255,0.3), white);
|
background-image: linear-gradient(to bottom, rgba(255,255,255,0.3), white);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
padding: ${(props: ReadMoreState) => props.open ? '0': '2em'};
|
padding: ${(props: ReadMoreState) => props.open ? '0' : '2em'};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const ReadMoreButton = styled.span`
|
const ReadMoreButton = styled.span`
|
||||||
|
@ -41,18 +40,17 @@ const ReadMoreButtonText = styled.span`
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|
||||||
export class ReadMore extends React.Component<ReadMoreProps, ReadMoreState> {
|
export class ReadMore extends React.Component<ReadMoreProps, ReadMoreState> {
|
||||||
constructor(props: ReadMoreProps) {
|
constructor(props: ReadMoreProps) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
open: false
|
open: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
toggle = () => {
|
toggle = () => {
|
||||||
this.setState(prevState => ({
|
this.setState(prevState => ({
|
||||||
open: !prevState.open
|
open: !prevState.open,
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -60,7 +58,7 @@ export class ReadMore extends React.Component<ReadMoreProps, ReadMoreState> {
|
||||||
const { content } = this.props;
|
const { content } = this.props;
|
||||||
|
|
||||||
if (!content) {
|
if (!content) {
|
||||||
return <ReadMoreWrapper open={false} />
|
return <ReadMoreWrapper open={false} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -16,10 +16,10 @@ import { RequestSamples } from '../RequestSamples/RequestSamples';
|
||||||
import { ResponsesList } from '../Responses/ResponsesList';
|
import { ResponsesList } from '../Responses/ResponsesList';
|
||||||
import { ResponseSamples } from '../ResponseSamples/ResponseSamples';
|
import { ResponseSamples } from '../ResponseSamples/ResponseSamples';
|
||||||
|
|
||||||
|
import { ReadMore } from '../../common-elements/ReadMore';
|
||||||
import { OperationModel as OperationType } from '../../services/models';
|
import { OperationModel as OperationType } from '../../services/models';
|
||||||
import styled from '../../styled-components';
|
import styled from '../../styled-components';
|
||||||
import { Extensions } from '../Fields/Extensions';
|
import { Extensions } from '../Fields/Extensions';
|
||||||
import { ReadMore } from "../../common-elements/ReadMore";
|
|
||||||
|
|
||||||
const OperationRow = styled(Row)`
|
const OperationRow = styled(Row)`
|
||||||
backface-visibility: hidden;
|
backface-visibility: hidden;
|
||||||
|
@ -40,12 +40,12 @@ export interface OperationProps {
|
||||||
|
|
||||||
function splitDescription(description) {
|
function splitDescription(description) {
|
||||||
if (!description) {
|
if (!description) {
|
||||||
return ["", ""];
|
return ['', ''];
|
||||||
} else {
|
} else {
|
||||||
// str#split split at all occurence of matched string.
|
// str#split split at all occurence of matched string.
|
||||||
// So "a<!--READMORE-->b<!--READMORE-->c" --> ["a", "<!..>", "b", "<!..>", "c"]
|
// So "a<!--READMORE-->b<!--READMORE-->c" --> ["a", "<!..>", "b", "<!..>", "c"]
|
||||||
const [head, ...rest] = description.split(ReadmorePattern);
|
const [head, ...rest] = description.split(ReadmorePattern);
|
||||||
const more = rest.join("");
|
const more = rest.join('');
|
||||||
return [head, more];
|
return [head, more];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user