|
1 | | -import React from "react"; |
2 | | -import { graphql, Link } from "gatsby"; |
3 | | -import Layout from "../components/Layout"; |
4 | | -import ScannerExamples from "../components/ScannerExamples.js"; |
| 1 | +import React from 'react'; |
| 2 | +import { graphql } from 'gatsby'; |
| 3 | +import Layout from '../components/Layout'; |
| 4 | +import ScannerExamples from '../components/ScannerExamples.js'; |
| 5 | +import Sidebar from '../components/Sidebar.js' |
5 | 6 |
|
6 | | -const Integration = props => { |
| 7 | +const Integration = (props) => { |
7 | 8 | const { title } = props.data.markdownRemark.frontmatter; |
8 | 9 | const { html } = props.data.markdownRemark; |
9 | | - const scanner = props.data.scanner.edges; |
10 | | - const persistenceProvider = props.data.persistenceProvider.edges; |
| 10 | + const scanners = props.data.scanner.edges; |
| 11 | + const persistenceProviders = props.data.persistenceProvider.edges; |
| 12 | + const hooks = props.data.hook.edges; |
11 | 13 |
|
12 | 14 | return ( |
13 | 15 | <Layout bodyClass="integration"> |
14 | 16 | <div className="sidebar-wrapper"> |
15 | | - <nav className="sidebar"> |
16 | | - <h1 className="sidebar-header">Scanner</h1> |
17 | | - <ul className="list-unstyled components"> |
18 | | - {scanner.map(scanner => ( |
19 | | - <li key={scanner.node.frontmatter.title}> |
20 | | - <Link |
21 | | - to={`/integrations/${scanner.node.frontmatter.path}`} |
22 | | - activeClassName="active-Link" |
23 | | - > |
24 | | - {scanner.node.frontmatter.title} |
25 | | - </Link> |
26 | | - </li> |
27 | | - ))} |
28 | | - </ul> |
29 | | - <h1 className="sidebar-header">Hooks</h1> |
30 | | - <ul className="list-unstyled components"> |
31 | | - {persistenceProvider.map(persistenceProvider => ( |
32 | | - <li key={persistenceProvider.node.frontmatter.title}> |
33 | | - <Link |
34 | | - to={`/integrations/${persistenceProvider.node.frontmatter.path}`} |
35 | | - activeClassName="active-Link" |
36 | | - > |
37 | | - {persistenceProvider.node.frontmatter.title} |
38 | | - </Link> |
39 | | - </li> |
40 | | - ))} |
41 | | - </ul> |
42 | | - </nav> |
43 | | - |
| 17 | + <Sidebar dataArray={[scanners, persistenceProviders, hooks]}/> |
44 | 18 | <div id="content"> |
45 | 19 | <div className="container-fluid" id="integration-doc"> |
46 | 20 | <h1 className="title">{title}</h1> |
47 | 21 | <div |
48 | 22 | className="content" |
49 | 23 | dangerouslySetInnerHTML={{ __html: html }} |
50 | 24 | /> |
51 | | - <ScannerExamples scanner={props.path} /> |
| 25 | + <ScannerExamples scanner={props.path} /> |
52 | 26 | </div> |
53 | 27 | </div> |
54 | 28 | </div> |
@@ -76,24 +50,56 @@ export const query = graphql` |
76 | 50 | path |
77 | 51 | category |
78 | 52 | usecase |
| 53 | + type |
| 54 | + state |
| 55 | + appVersion |
79 | 56 | } |
80 | 57 | } |
81 | 58 | } |
82 | 59 | } |
83 | | - persistenceProvider: allMarkdownRemark( |
| 60 | + hook: allMarkdownRemark( |
84 | 61 | filter: { |
85 | | - fileAbsolutePath: { regex: "/integrations/persistence-provider/" } |
| 62 | + frontmatter: { |
| 63 | + category: { eq: "hook" } |
| 64 | + type: { ne: "persistenceProvider" } |
| 65 | + } |
86 | 66 | } |
| 67 | + sort: { fields: [frontmatter___title], order: ASC } |
87 | 68 | ) { |
88 | 69 | edges { |
89 | 70 | node { |
| 71 | + html |
90 | 72 | frontmatter { |
91 | 73 | title |
92 | 74 | path |
93 | 75 | category |
| 76 | + usecase |
| 77 | + type |
| 78 | + state |
94 | 79 | } |
95 | | - id |
| 80 | + } |
| 81 | + } |
| 82 | + } |
| 83 | + persistenceProvider: allMarkdownRemark( |
| 84 | + filter: { |
| 85 | + frontmatter: { |
| 86 | + category: { eq: "hook" } |
| 87 | + type: { eq: "persistenceProvider" } |
| 88 | + } |
| 89 | + } |
| 90 | + sort: { fields: [frontmatter___title], order: ASC } |
| 91 | + ) { |
| 92 | + edges { |
| 93 | + node { |
96 | 94 | html |
| 95 | + frontmatter { |
| 96 | + title |
| 97 | + path |
| 98 | + category |
| 99 | + usecase |
| 100 | + type |
| 101 | + state |
| 102 | + } |
97 | 103 | } |
98 | 104 | } |
99 | 105 | } |
|
0 commit comments