Skip to content

Commit b5daf29

Browse files
committed
Fix issues
1 parent 9cb51ac commit b5daf29

File tree

6 files changed

+51
-19
lines changed

6 files changed

+51
-19
lines changed

gatsby-config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module.exports = {
88

99
plugins: [
1010
"gatsby-plugin-react-helmet",
11+
'gatsby-plugin-anchor-links',
1112
{
1213
resolve: "gatsby-source-filesystem",
1314
options: {

gatsby-node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ exports.createPages = async ({ graphql, actions }) => {
145145
let i = 0
146146
while (page && i++ < 1000) {
147147
const { frontmatter } = page
148-
const { definedCategory, next: definedNextPageUrl } = frontmatter
148+
const { category: definedCategory, next: definedNextPageUrl } = frontmatter
149149
let category = definedCategory || folder
150150
if (!currentCategory || category !== currentCategory.name) {
151151
currentCategory && categories.push(currentCategory)

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"codemirror": "5.58.1",
1717
"codemirror-graphql": "0.12.3",
1818
"gatsby": "2.24.78",
19+
"gatsby-plugin-anchor-links": "1.1.1",
1920
"gatsby-plugin-feed": "2.5.18",
2021
"gatsby-plugin-google-analytics": "2.3.18",
2122
"gatsby-plugin-less": "4.0.6",

src/components/DocsSidebar/index.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import React from "react"
22
import { Link } from "gatsby"
33
import { toSlug } from "../../utils/slug"
4+
import { AnchorLink } from "gatsby-plugin-anchor-links"
45

56
const SidebarForCategory = ({ category }: any) => {
6-
const listItems = category.links.map((page: any, i) => {
7+
const listItems = category.links.map((page: any, i: number) => {
78
return (
89
<li key={i}>
910
<Link
@@ -15,11 +16,14 @@ const SidebarForCategory = ({ category }: any) => {
1516
</Link>
1617
{page.frontmatter.sublinks && (
1718
<ul>
18-
{page.frontmatter.sublinks.split(",").map((sublink: any, i) => (
19+
{page.frontmatter.sublinks.split(",").map((sublink: any, i: number) => (
1920
<li key={i}>
20-
<Link to={page.frontmatter.permalink + "#" + toSlug(sublink)}>
21+
<AnchorLink
22+
title={sublink}
23+
to={page.frontmatter.permalink + "#" + toSlug(sublink)}
24+
>
2125
{sublink}
22-
</Link>
26+
</AnchorLink>
2327
</li>
2428
))}
2529
</ul>

src/pages/users.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
11
import React from "react"
22
import Layout from "../components/Layout"
33

4-
const iframe =
5-
'<iframe frameBorder="0" id="landscape" scrolling="no" style="width: 1px; min-width: 100%" src="https://landscape.graphql.org/category=graph-ql-adopter&format=card-mode&grouping=category&embed=yes"></iframe>'
6-
7-
const Iframe = props => {
8-
return (
9-
<div
10-
dangerouslySetInnerHTML={{ __html: props.iframe ? props.iframe : "" }}
11-
/>
12-
)
13-
}
14-
154
export default ({ pageContext }) => {
165
return (
176
<Layout title="Who's Using | GraphQL" pageContext={pageContext}>
@@ -36,9 +25,20 @@ export default ({ pageContext }) => {
3625
</p>
3726
</div>
3827

39-
<Iframe iframe={iframe} />
40-
41-
<script src="https://landscape.cncf.io/iframeResizer.js"></script>
28+
<iframe
29+
frameBorder="0"
30+
id="landscape"
31+
scrolling="no"
32+
style={{ width: "1px", minWidth: "100%" }}
33+
src="https://landscape.graphql.org/category=graph-ql-adopter&format=card-mode&grouping=category&embed=yes"
34+
onLoad={() => {
35+
const scriptElem = document.createElement('script');
36+
scriptElem.type = 'text/javascript';
37+
scriptElem.src = "https://landscape.cncf.io/iframeResizer.js";
38+
scriptElem.onload = () => (window as any)["iFrameResize"]();
39+
document.body.appendChild(scriptElem);
40+
}}
41+
></iframe>
4242
</section>
4343
</Layout>
4444
)

yarn.lock

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5864,6 +5864,13 @@ gatsby-page-utils@^0.2.28:
58645864
lodash "^4.17.20"
58655865
micromatch "^4.0.2"
58665866

5867+
5868+
version "1.1.1"
5869+
resolved "https://registry.yarnpkg.com/gatsby-plugin-anchor-links/-/gatsby-plugin-anchor-links-1.1.1.tgz#6a04441f5acc42768447dc6c12474630520a9f90"
5870+
integrity sha512-mgSHUAEa7RRWD/lcmJVUWD9mIT14EIJvMPcxJ1W2Ev+rNuqBBpk1j4vDWy1uxas+qusi0vrtZ4HdU7mse12qDw==
5871+
dependencies:
5872+
scroll-to-element "^2.0.3"
5873+
58675874
58685875
version "2.5.18"
58695876
resolved "https://registry.yarnpkg.com/gatsby-plugin-feed/-/gatsby-plugin-feed-2.5.18.tgz#5ab729bbf08deac8fe2bcc7262b651f73fe6c8d7"
@@ -9713,6 +9720,11 @@ pbkdf2@^3.0.3:
97139720
safe-buffer "^5.0.1"
97149721
sha.js "^2.4.8"
97159722

9723+
performance-now@^2.1.0:
9724+
version "2.1.0"
9725+
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
9726+
integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=
9727+
97169728
physical-cpu-count@^2.0.0:
97179729
version "2.0.0"
97189730
resolved "https://registry.yarnpkg.com/physical-cpu-count/-/physical-cpu-count-2.0.0.tgz#18de2f97e4bf7a9551ad7511942b5496f7aba660"
@@ -10419,6 +10431,13 @@ querystringify@^2.1.1:
1041910431
resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6"
1042010432
integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==
1042110433

10434+
raf@^3.4.0:
10435+
version "3.4.1"
10436+
resolved "https://registry.yarnpkg.com/raf/-/raf-3.4.1.tgz#0742e99a4a6552f445d73e3ee0328af0ff1ede39"
10437+
integrity sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==
10438+
dependencies:
10439+
performance-now "^2.1.0"
10440+
1042210441
randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5, randombytes@^2.1.0:
1042310442
version "2.1.0"
1042410443
resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a"
@@ -11335,6 +11354,13 @@ schema-utils@^2.6.6:
1133511354
ajv "^6.12.4"
1133611355
ajv-keywords "^3.5.2"
1133711356

11357+
scroll-to-element@^2.0.3:
11358+
version "2.0.3"
11359+
resolved "https://registry.yarnpkg.com/scroll-to-element/-/scroll-to-element-2.0.3.tgz#99b404fc6a09fe73f3c062cd5b8a14efb6404e4d"
11360+
integrity sha512-5herPcm9jMfQgRwu94lH5mei+2YhipR4RQ2nAvnBxJb2tG+P7O0ctOKAaAZBXbBejnn+MImh3wrAUA5EcLnjEQ==
11361+
dependencies:
11362+
raf "^3.4.0"
11363+
1133811364
section-matter@^1.0.0:
1133911365
version "1.0.0"
1134011366
resolved "https://registry.yarnpkg.com/section-matter/-/section-matter-1.0.0.tgz#e9041953506780ec01d59f292a19c7b850b84167"

0 commit comments

Comments
 (0)