-
Notifications
You must be signed in to change notification settings - Fork 227
/
Copy pathexamples.js
77 lines (75 loc) · 2.39 KB
/
examples.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import classNames from 'classnames';
import { DocLinksBlock } from 'components/pages/doc-examples/doc-links-block';
import TableOfContents from 'components/pages/doc-page/table-of-contents';
import { PageInfo } from 'components/pages/doc-welcome/page-info';
import docPageContent from 'components/templates/doc-page/doc-page-content/doc-page-content.module.scss';
import { graphql, useStaticQuery } from 'gatsby';
import { useScrollToAnchor } from 'hooks';
import { DocLayout } from 'layouts/doc-layout';
import React, { useRef } from 'react';
import { StickyContainer, Sticky } from 'react-sticky';
import SeoMetadata from 'utils/seo-metadata';
export default function ({ pageContext: { sidebarTree, navLinks } }) {
useScrollToAnchor();
const contentContainerRef = useRef(null);
const pageMetadata = SeoMetadata.examples;
const {
docExamplesJson: { tutorialsBlockLinks, examplesBlockLinks },
} = useStaticQuery(graphql`
query blockLinksData {
docExamplesJson {
tutorialsBlockLinks: tutorials {
title
description
url
to
}
examplesBlockLinks: examples {
title
description
url
to
}
}
}
`);
const stickyContainerClasses = classNames(
docPageContent.mainDocContent,
docPageContent.contentWrapper,
);
return (
<DocLayout
sidebarTree={sidebarTree}
navLinks={navLinks}
pageMetadata={pageMetadata}
>
<PageInfo
title={'Examples & Tutorials'}
description={
'This section lists a few of the most common k6 code examples and popular tutorials.'
}
/>
<div className={`${docPageContent.inner} `}>
<StickyContainer>
<div ref={contentContainerRef} className={stickyContainerClasses}>
<DocLinksBlock title={'Examples'} links={examplesBlockLinks} />
<DocLinksBlock
title={'Tutorials'}
links={tutorialsBlockLinks}
last
/>
</div>
<Sticky topOffset={-15} bottomOffset={0} disableCompensation>
{({ style }) => (
<TableOfContents
style={{ ...style, left: 350 }}
contentContainerRef={contentContainerRef}
shouldMakeReplacement
/>
)}
</Sticky>
</StickyContainer>
</div>
</DocLayout>
);
}