Skip to content

Commit 6beb19a

Browse files
authored
Merge pull request linode#33 from linode/development
Deployment
2 parents 8249d6c + e14ad7d commit 6beb19a

39 files changed

+487
-350
lines changed

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@
4444
"gatsby"
4545
],
4646
"license": "MIT",
47+
"browserslist": [
48+
"last 2 version",
49+
"> 2%"
50+
],
4751
"scripts": {
4852
"build": "./getDependencies.sh && gatsby build && node search/buildIndex.js",
4953
"develop": "./getDependencies.sh && gatsby develop",

postcss.config.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ module.exports = {
1313
plugins: [
1414
atImport,
1515
tailwindcss("./tailwind.js"),
16-
autoprefixer({
17-
browsers: ["last 2 versions", "> 2%"]
18-
}),
16+
autoprefixer(),
1917
cssnano({
2018
preset: "default"
2119
})

src/components/2_molecules/BodySchema.js

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,41 @@
1+
import { getOr } from 'lodash/fp';
12
import React from "react";
23
import Markdown from "react-markdown/with-html";
34

45
import CharDisplay from "./charDisplay";
56

67
export const BodySchema = props => {
78
const { data } = props;
9+
const requiredProperties = getOr([], ['requestBody', 'content', 'application_json', 'schema', 'required'], data) || [];
10+
const properties = getOr(null, ['requestBody', 'content', 'application_json', 'schema', 'properties'], data);
11+
12+
const sortByRequired = (a, b) => {
13+
const r1 = requiredProperties.includes(a) ? 1 : 0;
14+
const r2 = requiredProperties.includes(b) ? 1 : 0;
15+
// sorting and adding required fields at the top
16+
if (r1 > r2) {
17+
return -1;
18+
}
19+
if (r1 < r2) {
20+
return 1;
21+
}
22+
if (a > b) {
23+
return 1;
24+
}
25+
if (a < b) {
26+
return -1;
27+
}
28+
return 0;
29+
}
830

931
return (
1032
<>
1133
<div className="my-8">
1234
<h3>Request Body Schema</h3>
1335
</div>
14-
{data.requestBody.content.application_json &&
15-
data.requestBody.content.application_json.schema &&
16-
data.requestBody.content.application_json.schema.properties &&
17-
Object.keys(data.requestBody.content.application_json.schema.properties)
18-
.sort((a, b) => {
19-
const required =
20-
data.requestBody.content.application_json.schema.required || [];
21-
const r1 = required.includes(a) ? 1 : 0;
22-
const r2 = required.includes(b) ? 1 : 0;
23-
// sorting and adding required fields at the top
24-
if (r1 > r2) {
25-
return -1;
26-
}
27-
if (r1 < r2) {
28-
return 1;
29-
}
30-
if (a > b) {
31-
return 1;
32-
}
33-
if (a < b) {
34-
return -1;
35-
}
36-
return 0;
37-
})
36+
{properties &&
37+
Object.keys(properties)
38+
.sort(sortByRequired)
3839
.map((p, i) => {
3940
const b =
4041
data.requestBody.content.application_json.schema.properties[p];
@@ -105,9 +106,10 @@ export const BodySchema = props => {
105106
s.properties &&
106107
Object.keys(s.properties).map((p, i) => {
107108
const b = s.properties[p];
109+
console.log(b)
108110
return (
109111
b &&
110-
b.readOnly === undefined && (
112+
b.x_linode_cli_display !== 1 && (
111113
<div key={i} className="response-wrapper">
112114
<div className="lg:flex pt-2 mb-4 initResponse">
113115
<div className="w-full lg:w-1/4">

src/components/2_molecules/ResponseItemElements.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,10 @@ export const ResponseItemElements = props => {
223223
<div className="w-full lg:w-3/4">
224224
<div>
225225
<div className="text-sm text-grey-darkest">
226-
{data.type && data.type}{" "}
227-
{data.pattern && (
226+
{dps.type && dps.type}{" "}
227+
{dps.pattern && (
228228
<span className="tag">
229-
{data.pattern}
229+
{dps.pattern}
230230
</span>
231231
)}
232232
</div>

src/components/2_molecules/changelog-item.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React from "react";
22
import PropTypes from "prop-types";
33

4+
import Link from "../../images/svgs/link.svg";
5+
46
class ChangelogItem extends React.Component {
57
componentDidMount() {
68
const hash = document.location.hash;
@@ -11,7 +13,7 @@ class ChangelogItem extends React.Component {
1113
() =>
1214
document
1315
.getElementById(hash.substr(1))
14-
.scrollIntoView({ block: "start", behavior: "smooth" }),
16+
.scrollIntoView({ block: "start" }),
1517
50
1618
);
1719
}
@@ -52,7 +54,7 @@ class ChangelogItem extends React.Component {
5254
className="mt-0 text-2xl font-normal"
5355
itemProp="alternativeHeadline"
5456
>
55-
{title}
57+
<a href={`#${link}`} className="changelog-anchor-link"><Link /></a>{title}
5658
</h2>
5759
<div
5860
className="changelog-entry"

0 commit comments

Comments
 (0)