This repository has been archived by the owner on Nov 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move response metadata into a separate component
- Loading branch information
Dom Harrington
committed
Nov 2, 2017
1 parent
1d7d91e
commit 67b9a03
Showing
2 changed files
with
69 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
const React = require('react'); | ||
const IconStatus = require('./IconStatus'); | ||
const PropTypes = require('prop-types'); | ||
|
||
function ResponseMetadata({ result }) { | ||
return ( | ||
<div className="hub-reference-results-meta tabber-body-metadata tabber-body" | ||
style={{ display: 'block' }} | ||
> | ||
<div className="meta"> | ||
{ | ||
// eslint-disable-next-line jsx-a11y/label-has-for | ||
<label>Method</label> | ||
} | ||
<div>{result.method.toString()}</div> | ||
</div> | ||
|
||
<div className="meta"> | ||
{ | ||
// eslint-disable-next-line jsx-a11y/label-has-for | ||
<label>URL</label> | ||
} | ||
<div>{result.url}</div> | ||
</div> | ||
|
||
<div className="meta"> | ||
{ | ||
// eslint-disable-next-line jsx-a11y/label-has-for | ||
<label>Request Headers</label> | ||
} | ||
<pre>{result.requestHeaders.join('\n')}</pre> | ||
</div> | ||
|
||
<div className="meta"> | ||
{ | ||
// eslint-disable-next-line jsx-a11y/label-has-for | ||
<label>Request Data</label> | ||
} | ||
<pre>{JSON.stringify(result.responseBody)}</pre> | ||
</div> | ||
|
||
<div className="meta"> | ||
{ | ||
// eslint-disable-next-line jsx-a11y/label-has-for | ||
<label> Status</label> | ||
} | ||
<span className="httpstatus"> | ||
<IconStatus result={result} /> | ||
</span> | ||
</div> | ||
|
||
<div className="meta"> | ||
{ | ||
// eslint-disable-next-line jsx-a11y/label-has-for | ||
<label>Response Headers</label> | ||
} | ||
<pre>{result.responseHeaders.join('\n')}</pre> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
module.exports = ResponseMetadata; | ||
|
||
ResponseMetadata.propTypes = { | ||
result: PropTypes.shape({}).isRequired, | ||
}; |