Skip to content

Commit 79d89a7

Browse files
author
Alban Bailly
committed
fix build fail
1 parent f60e043 commit 79d89a7

File tree

2 files changed

+67
-59
lines changed

2 files changed

+67
-59
lines changed

src/css/components/4_pages/api-page.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,11 @@
201201
z-index: 100;
202202
border-radius: 50%;
203203
box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
204-
bottom: 44px;
204+
bottom: 20px;
205205
width: 60px;
206206
height: 60px;
207207
padding: 0 20px;
208+
outline: 0 !important;
208209
}
209210

210211
.is-visible {

src/pages/api/v4.js

Lines changed: 65 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from "react";
22
// import PropTypes from "prop-types";
3-
import { graphql } from "gatsby";
3+
import { graphql, StaticQuery } from "gatsby";
44
import Markdown from "react-markdown/with-html";
55

66
import Layout from "../../components/4_layouts/layout";
@@ -27,69 +27,76 @@ const HeadingRenderer = props => {
2727
return <Heading {...props} />;
2828
};
2929

30-
window.addEventListener("scroll", () => {
31-
const top = window.scrollY;
32-
const scrollButton = document.getElementById("back-to-top");
33-
if (top >= 50) {
34-
scrollButton.classList.add("is-visible");
35-
} else {
36-
scrollButton.classList.remove("is-visible");
30+
class APIDocs extends React.Component {
31+
componentDidMount() {
32+
window.addEventListener("scroll", () => {
33+
const top = window.scrollY;
34+
const scrollButton = document.getElementById("back-to-top");
35+
if (top >= 50) {
36+
scrollButton.classList.add("is-visible");
37+
} else {
38+
scrollButton.classList.remove("is-visible");
39+
}
40+
});
3741
}
38-
});
3942

40-
const APIDocs = ({ data }) => {
41-
const n = data.allDataJson.edges[0].node;
43+
render() {
44+
const n = this.props.data.allDataJson.edges[0].node;
4245

43-
return (
44-
<Layout
45-
// title="API Documentation"
46-
// subtitle="Linode API Documentation"
47-
fullWidth
48-
>
49-
<SEO title="API Documentation" description="" />
50-
<div className="flex flex-wrap">
51-
<div className="md:hidden search-header-wrapper">
52-
<SearchHeader />
53-
</div>
54-
<div className="sidebar-container">
55-
<Sidebar />
56-
</div>
57-
<div className="w-full px-4 api-content-wrapper">
58-
<div className="api-content mx-auto">
59-
<Markdown
60-
source={n.info.description}
61-
escapeHtml={false}
62-
renderers={{ heading: HeadingRenderer }}
63-
className="md:mt-8 api-body"
64-
/>
46+
return (
47+
<Layout
48+
// title="API Documentation"
49+
// subtitle="Linode API Documentation"
50+
fullWidth
51+
>
52+
<SEO title="API Documentation" description="" />
53+
<div className="flex flex-wrap">
54+
<div className="md:hidden search-header-wrapper">
55+
<SearchHeader />
56+
</div>
57+
<div className="sidebar-container">
58+
<Sidebar />
59+
</div>
60+
<div className="w-full px-4 api-content-wrapper">
61+
<div className="api-content mx-auto">
62+
<Markdown
63+
source={n.info.description}
64+
escapeHtml={false}
65+
renderers={{ heading: HeadingRenderer }}
66+
className="md:mt-8 api-body"
67+
/>
68+
</div>
6569
</div>
6670
</div>
67-
</div>
68-
<div
69-
className="back-to-top md:hidden"
70-
onClick={scrollToTop}
71-
id="back-to-top"
72-
>
73-
<span className="back-to-top__caret">
74-
<Caret />
75-
</span>
76-
</div>
77-
</Layout>
78-
);
79-
};
71+
<button
72+
className="back-to-top md:hidden"
73+
onClick={scrollToTop}
74+
id="back-to-top"
75+
>
76+
<span className="back-to-top__caret">
77+
<Caret />
78+
</span>
79+
</button>
80+
</Layout>
81+
);
82+
}
83+
}
8084

81-
export const query = graphql`
82-
query apiV4 {
83-
allDataJson {
84-
edges {
85-
node {
86-
info {
87-
description
85+
export default props => (
86+
<StaticQuery
87+
query={graphql`
88+
query {
89+
allDataJson {
90+
edges {
91+
node {
92+
info {
93+
description
94+
}
95+
}
8896
}
8997
}
9098
}
91-
}
92-
}
93-
`;
94-
95-
export default APIDocs;
99+
`}
100+
render={data => <APIDocs data={data} {...props} />}
101+
/>
102+
);

0 commit comments

Comments
 (0)