Tidy inline docs and added sdk support table.

This commit is contained in:
orangemug
2020-01-23 08:33:12 +00:00
parent 17aa88e3b6
commit 30facc885f
27 changed files with 204 additions and 88 deletions

View File

@@ -1,13 +1,15 @@
import React from 'react'
import PropTypes from 'prop-types'
import {MdInfoOutline, MdHighlightOff} from 'react-icons/md'
export default class DocLabel extends React.Component {
static propTypes = {
label: PropTypes.oneOfType([
PropTypes.object,
PropTypes.string
]).isRequired,
doc: PropTypes.string.isRequired,
fieldSpec: PropTypes.object.isRequired,
}
constructor (props) {
@@ -28,19 +30,26 @@ export default class DocLabel extends React.Component {
}
render() {
return <label className="maputnik-doc-wrapper">
<div className="maputnik-doc-target">
<span>
{this.props.label}
const {label, fieldSpec} = this.props;
const {doc} = fieldSpec || {};
if (doc) {
return <label className="maputnik-doc-wrapper">
<div className="maputnik-doc-target">
{label}
{'\xa0'}
<button
aria-label={this.state.open ? "close property documentation" : "open property documentation"}
className={`maputnik-doc-button maputnik-doc-button--${this.state.open ? 'open' : 'closed'}`}
onClick={() => this.onToggleDoc(!this.state.open)}
>
{this.state.open ? 'x' : '?'}
{this.state.open ? <MdHighlightOff /> : <MdInfoOutline />}
</button>
</span>
</div>
</label>
</div>
</label>
}
else {
return <div />
}
}
}