Skip to content

Commit dc3cd98

Browse files
author
Alban
authored
Merge pull request linode#1 from linode/DLC-144
DLC-144
2 parents efc1d57 + c641fec commit dc3cd98

File tree

13 files changed

+66
-90742
lines changed

13 files changed

+66
-90742
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ yarn-error.log
7171
# Linode base theme
7272
linode-hugo-theme
7373

74-
themes/
74+
themes/

gatsby-config.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
const fs = require("fs");
2-
const path = require("path");
3-
4-
const fromJson = filePath => {
5-
return new Promise((resolve, reject) => {
6-
fs.readFile(filePath, "utf8", (err, data) => {
7-
if (err) {
8-
reject(err);
9-
return;
10-
}
11-
12-
resolve(data);
13-
});
14-
});
15-
};
16-
171
module.exports = {
182
siteMetadata: {
193
title: `Linode Developer Tools`,

getBaseTheme.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

getDependencies.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
BLUE='\033[0;34m'
2+
NC='\033[0m' # No Color
3+
4+
echo
5+
echo "${BLUE}Fetching base theme${NC}"
6+
if
7+
cd linode-hugo-theme; then
8+
git pull origin development; else
9+
git clone https://github.com/linode/linode-hugo-theme.git;
10+
fi
11+
12+
echo
13+
echo "${BLUE}Fetching API specs${NC}"
14+
cd -
15+
curl https://developers.linode.com/api/docs/v4/openapi.yaml > src/data/openapi.yaml
16+
17+
echo
18+
echo "${BLUE}Removing faulty data${NC}"
19+
sed -i '/backgroundColor:/d' src/data/openapi.yaml
20+
21+
echo
22+
echo "${BLUE}Converting YAML to JSON${NC}"
23+
npm install -g yamljs
24+
yaml2json src/data/openapi.yaml > src/data/spec.json

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"gatsby-transformer-json": "^2.1.11",
2222
"gatsby-transformer-remark": "^2.1.1-rc.5",
2323
"gatsby-transformer-sharp": "^2.1.13",
24-
"gatsby-transformer-yaml": "^2.1.8",
2524
"json-schema-ref-parser": "^6.1.0",
2625
"postcss-easy-import": "^3.0.0",
2726
"prop-types": "^15.6.2",
@@ -41,8 +40,8 @@
4140
],
4241
"license": "MIT",
4342
"scripts": {
44-
"build": "./getBaseTheme.sh && gatsby build && node search/buildIndex.js",
45-
"develop": "./getBaseTheme.sh && gatsby develop",
43+
"build": "./getDependencies.sh && gatsby build && node search/buildIndex.js",
44+
"develop": "./getDependencies.sh && gatsby develop",
4645
"start": "npm run develop",
4746
"serve": "gatsby serve",
4847
"test": "echo \"Write tests! -> https://gatsby.app/unit-testing\""

src/components/1_atoms/APITitle.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import React from "react";
2+
import { StaticQuery, graphql, Link } from "gatsby";
3+
4+
const APITitle = ({ data }) => {
5+
const n = data.allDataJson.edges[0].node;
6+
7+
return (
8+
<div className="mb-4">
9+
<div className="mb-4">
10+
<Link to="/">developers.linode.com</Link>
11+
</div>
12+
<div className="text-2xl">Linode API {n.info.version}</div>
13+
</div>
14+
);
15+
};
16+
17+
export default props => (
18+
<StaticQuery
19+
query={graphql`
20+
query {
21+
allDataJson {
22+
edges {
23+
node {
24+
info {
25+
version
26+
}
27+
}
28+
}
29+
}
30+
}
31+
`}
32+
render={data => <APITitle data={data} {...props} />}
33+
/>
34+
);

src/components/2_molecules/sidemenu.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React from "react";
22
import { graphql, StaticQuery } from "gatsby";
33
import { Link } from "gatsby";
4+
5+
import APITitle from "../1_atoms/APITitle";
46
import SearchHeader from "./search-header";
57

68
import Caret from "../../images/svgs/caret.svg";
@@ -71,6 +73,7 @@ class SideMenu extends React.Component {
7173
return (
7274
<div className="api-navigation-wrapper bg-ThemeCell">
7375
<div className="api-navigation">
76+
<APITitle />
7477
<SearchHeader />
7578
<div>
7679
{groups.map((group, i) => {

src/data/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
openapi.yaml
2+
spec.json

0 commit comments

Comments
 (0)