Fix lint errors.

This commit is contained in:
exoego 2018-11-11 20:10:07 +09:00
parent d6849fb5fa
commit f036c414bc
2 changed files with 11 additions and 13 deletions

View File

@ -1,16 +1,15 @@
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`
@ -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 (

View File

@ -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];
} }
} }