Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: added markdown for header descriptions as per specifications #5120

Merged
merged 5 commits into from
Jan 12, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/core/components/headers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import Im from "immutable"
const propStyle = { color: "#999", fontStyle: "italic" }

export default class Headers extends React.Component {

static propTypes = {
headers: PropTypes.object.isRequired,
getComponent: PropTypes.func.isRequired
};

render() {

let { headers, getComponent } = this.props

const Property = getComponent("Property")
const Markdown = getComponent("Markdown")

if ( !headers || !headers.size )
return null
Expand All @@ -36,12 +36,16 @@ export default class Headers extends React.Component {
if(!Im.Map.isMap(header)) {
return null
}

const description = header.get("description")
const type = header.getIn(["schema"]) ? header.getIn(["schema", "type"]) : header.getIn(["type"])
const schemaExample = header.getIn(["schema", "example"])

return (<tr key={ key }>
<td className="header-col">{ key }</td>
<td className="header-col">{ header.get( "description" ) }</td>
<td className="header-col">{
!description ? null : <Markdown source={ description } />
}</td>
<td className="header-col">{ type } { schemaExample ? <Property propKey={ "Example" } propVal={ schemaExample } propStyle={ propStyle } /> : null }</td>
</tr>)
}).toArray()
Expand Down