Added property values to docs

This commit is contained in:
orangemug 2020-01-24 09:04:32 +00:00
parent 62f3cbe8fb
commit b31537e063
2 changed files with 30 additions and 6 deletions

View file

@ -9,7 +9,7 @@ export default class SpecDoc extends React.Component {
render () {
const {fieldSpec} = this.props;
const {doc} = fieldSpec;
const {doc, values} = fieldSpec;
const sdkSupport = fieldSpec['sdk-support'];
const headers = {
@ -22,11 +22,25 @@ export default class SpecDoc extends React.Component {
return (
<>
{doc &&
<div>{doc}</div>
<div className="SpecDoc">
<div className="SpecDoc__doc">{doc}</div>
{values &&
<ul className="SpecDoc__values">
{Object.entries(values).map(([key, value]) => {
return (
<li key={key}>
<code>{JSON.stringify(key)}</code>
<div>{value.doc}</div>
</li>
);
})}
</ul>
}
</div>
}
{sdkSupport &&
<div className="sdk-support">
<table className="sdk-support__table">
<div className="SpecDoc__sdk-support">
<table className="SpecDoc__sdk-support__table">
<thead>
<tr>
<th></th>

View file

@ -194,13 +194,13 @@
overflow: hidden;
}
.sdk-support {
.SpecDoc__sdk-support {
position: relative;
max-width: 100%;
overflow-x: auto;
}
.sdk-support__table {
.SpecDoc__sdk-support__table {
width: 100%;
margin-top: $margin-3;
@ -210,3 +210,13 @@
white-space: nowrap;
}
}
.SpecDoc__values li {
margin-top: $margin-3;
}
.SpecDoc__values code {
background: $color-midgray;
padding: 0.1em 0.3em;
border-radius: 2px;
}