Lint fixes.

This commit is contained in:
orangemug 2020-01-23 08:42:20 +00:00
parent 30facc885f
commit 62f3cbe8fb
3 changed files with 57 additions and 48 deletions

View file

@ -10,6 +10,7 @@ export default class DocLabel extends React.Component {
PropTypes.string PropTypes.string
]).isRequired, ]).isRequired,
fieldSpec: PropTypes.object.isRequired, fieldSpec: PropTypes.object.isRequired,
onToggleDoc: PropTypes.func.isRequired,
} }
constructor (props) { constructor (props) {

View file

@ -17,6 +17,7 @@ class InputBlock extends React.Component {
children: PropTypes.node.isRequired, children: PropTypes.node.isRequired,
style: PropTypes.object, style: PropTypes.object,
onChange: PropTypes.func, onChange: PropTypes.func,
fieldSpec: PropTypes.object,
} }
constructor (props) { constructor (props) {

View file

@ -1,55 +1,62 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types'
export default function SpecDoc (props={}) { export default class SpecDoc extends React.Component {
const {fieldSpec} = props; static propTypes = {
fieldSpec: PropTypes.object.isRequired,
}
const {doc} = fieldSpec; render () {
const sdkSupport = fieldSpec['sdk-support']; const {fieldSpec} = this.props;
const headers = { const {doc} = fieldSpec;
js: "JS", const sdkSupport = fieldSpec['sdk-support'];
android: "Android",
ios: "iOS",
macos: "macOS",
};
return ( const headers = {
<> js: "JS",
{doc && android: "Android",
<div>{doc}</div> ios: "iOS",
} macos: "macOS",
{sdkSupport && };
<div className="sdk-support">
<table className="sdk-support__table"> return (
<thead> <>
<tr> {doc &&
<th></th> <div>{doc}</div>
{Object.values(headers).map(header => { }
return <th key={header}>{header}</th>; {sdkSupport &&
<div className="sdk-support">
<table className="sdk-support__table">
<thead>
<tr>
<th></th>
{Object.values(headers).map(header => {
return <th key={header}>{header}</th>;
})}
</tr>
</thead>
<tbody>
{Object.entries(sdkSupport).map(([key, supportObj]) => {
return (
<tr key={key}>
<td>{key}</td>
{Object.keys(headers).map(k => {
const value = supportObj[k];
if (supportObj.hasOwnProperty(k)) {
return <td key={k}>{supportObj[k]}</td>;
}
else {
return <td key={k}>no</td>;
}
})}
</tr>
);
})} })}
</tr> </tbody>
</thead> </table>
<tbody> </div>
{Object.entries(sdkSupport).map(([key, supportObj]) => { }
return ( </>
<tr key={key}> );
<td>{key}</td> }
{Object.keys(headers).map(k => {
const value = supportObj[k];
if (supportObj.hasOwnProperty(k)) {
return <td key={k}>{supportObj[k]}</td>;
}
else {
return <td key={k}>no</td>;
}
})}
</tr>
);
})}
</tbody>
</table>
</div>
}
</>
);
} }