Skip to content

Commit 26cab61

Browse files
authored
Merge pull request #3543 from shockey/bug/oas3-link-display-issues
Correct funky CSS for links
2 parents 8d7f2dd + 9bb0cd7 commit 26cab61

File tree

5 files changed

+29
-6
lines changed

5 files changed

+29
-6
lines changed

src/core/components/response.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,10 @@ export default class Response extends React.Component {
122122

123123

124124
</td>
125-
{specSelectors.isOAS3() ? <td>
125+
{specSelectors.isOAS3() ? <td className="col response-col_links">
126126
{ links ?
127127
links.toSeq().map((link, key) => {
128-
return <OperationLink key={key} name={key} link={ link }/>
128+
return <OperationLink key={key} name={key} link={ link } getComponent={getComponent}/>
129129
})
130130
: <i>No links</i>}
131131
</td> : null}

src/core/components/responses.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export default class Responses extends React.Component {
6868
<tr className="responses-header">
6969
<td className="col col_header response-col_status">Code</td>
7070
<td className="col col_header response-col_description">Description</td>
71-
{ specSelectors.isOAS3() ? <td className="col col_header response-col_description">Links</td> : null }
71+
{ specSelectors.isOAS3() ? <td className="col col_header response-col_links">Links</td> : null }
7272
</tr>
7373
</thead>
7474
<tbody>

src/core/plugins/oas3/components/operation-link.jsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,19 @@ import ImPropTypes from "react-immutable-proptypes"
44

55
class OperationLink extends Component {
66
render() {
7-
const { link, name } = this.props
7+
const { link, name, getComponent } = this.props
8+
9+
const Markdown = getComponent("Markdown")
810

911
let targetOp = link.get("operationId") || link.get("operationRef")
1012
let parameters = link.get("parameters") && link.get("parameters").toJS()
1113
let description = link.get("description")
1214

1315
return <span>
14-
<div style={{ padding: "5px 2px" }}>{name}{description ? `: ${description}` : ""}</div>
16+
<div style={{ marginTop: "1.5em", marginBottom: ".5em" }}>
17+
<b><code>{name}</code></b>
18+
{ description ? <Markdown source={description}></Markdown> : null }
19+
</div>
1520
<pre>
1621
Operation `{targetOp}`<br /><br />
1722
Parameters {padString(0, JSON.stringify(parameters, null, 2)) || "{}"}<br />
@@ -30,6 +35,7 @@ function padString(n, string) {
3035
}
3136

3237
OperationLink.propTypes = {
38+
getComponent: PropTypes.func.isRequired,
3339
link: ImPropTypes.orderedMap.isRequired,
3440
name: PropTypes.String
3541
}

src/style/_layout.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,22 @@
522522
}
523523
}
524524

525+
.response-col_links
526+
{
527+
padding-left: 2em;
528+
max-width: 40em;
529+
font-size: 14px;
530+
531+
@include text_body();
532+
533+
.response-undocumented
534+
{
535+
font-size: 11px;
536+
537+
@include text_code(#999);
538+
}
539+
}
540+
525541
.response-col_description__inner
526542
{
527543
span

src/style/_table.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ table
5252

5353
&:first-of-type
5454
{
55-
width: 20%;
55+
max-width: 20%;
56+
min-width: 6em;
5657
padding: 10px 0;
5758
}
5859
}

0 commit comments

Comments
 (0)