@@ -2,20 +2,24 @@ import React from "react"
22import PropTypes from "prop-types"
33import Im from "immutable"
44
5+ const propStyle = { color : "#999" , fontStyle : "italic" }
6+
57export default class Headers extends React . Component {
68
79 static propTypes = {
8- headers : PropTypes . object . isRequired
10+ headers : PropTypes . object . isRequired ,
11+ getComponent : PropTypes . func . isRequired
912 } ;
1013
1114 render ( ) {
1215
13- let { headers } = this . props
16+ let { headers, getComponent } = this . props
17+ const Property = getComponent ( "Property" )
1418
1519 if ( ! headers || ! headers . size )
1620 return null
1721
18- return (
22+ return (
1923 < div className = "headers-wrapper" >
2024 < h4 className = "headers__title" > Headers:</ h4 >
2125 < table className = "headers" >
@@ -32,10 +36,13 @@ export default class Headers extends React.Component {
3236 if ( ! Im . Map . isMap ( header ) ) {
3337 return null
3438 }
39+ const type = header . getIn ( [ "schema" ] ) ? header . getIn ( [ "schema" , "type" ] ) : header . getIn ( [ "type" ] )
40+ const schemaExample = header . getIn ( [ "schema" , "example" ] )
41+
3542 return ( < tr key = { key } >
3643 < td className = "header-col" > { key } </ td >
3744 < td className = "header-col" > { header . get ( "description" ) } </ td >
38- < td className = "header-col" > { header . get ( "type" ) } </ td >
45+ < td className = "header-col" > { type } { schemaExample ? < Property propKey = { "Example" } propVal = { schemaExample } propStyle = { propStyle } /> : null } </ td >
3946 </ tr > )
4047 } ) . toArray ( )
4148 }
0 commit comments