Skip to content
This repository was archived by the owner on Apr 21, 2026. It is now read-only.

Commit 3db23ed

Browse files
authored
Merge pull request #14 from secureCodeBox/bugfix/v2-integrations-sidemenu
Bugfix/v2 integrations sidemenu
2 parents 2d06e0c + 1fb4c71 commit 3db23ed

7 files changed

Lines changed: 262 additions & 271 deletions

File tree

package-lock.json

Lines changed: 14 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"react-burger-menu": "^2.7.0",
3030
"react-dom": "^16.13.1",
3131
"react-helmet": "^6.1.0",
32+
"react-icons": "^3.11.0",
3233
"react-tabs": "^3.1.1"
3334
},
3435
"devDependencies": {

src/components/MenuMobile.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,25 @@ const MenuMobile = props => {
99
<Menu
1010
right
1111
id="slide"
12-
width={"100vw"}
13-
className={`main-menu-mobile ${props.active ? "open" : ""}`}
14-
customBurgerIcon={<img src={hamburgerIcon} alt="menu"/>}
12+
width={'100vw'}
13+
className={`main-menu-mobile ${props.active ? 'open' : ''}`}
14+
customBurgerIcon={<img src={hamburgerIcon} alt="menu" />}
1515
styles={{
1616
bmBurgerBars: {
17-
height: "3px"
18-
}
17+
height: '3px',
18+
},
1919
}}
2020
>
21-
{menuLinks.map(link => (
22-
<Link to={link.link} key={link.name}>{link.name}</Link>
21+
{menuLinks.map((link) => (
22+
<li key={link.name}>
23+
{link.external ? (
24+
<a href={link.link} target="_blank" rel="noopener noreferrer">
25+
{link.name}
26+
</a>
27+
) : (
28+
<Link to={link.link}>{link.name}</Link>
29+
)}
30+
</li>
2331
))}
2432
</Menu>
2533
);
@@ -33,6 +41,7 @@ export default props => (
3341
siteMetadata {
3442
menuLinks {
3543
name
44+
external
3645
link
3746
}
3847
}

src/components/ScannerExamples.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ import 'react-tabs/style/react-tabs.css';
55

66
const PREFIX = 23
77
export default function ScannerExamples(props) {
8-
9-
console.log(props.scanner);
10-
118
const scanner = props.scanner.substring(PREFIX);
129
const query = graphql`
1310
query {

src/components/Sidebar.js

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import React, { Fragment, useState } from 'react';
2+
import { Link } from 'gatsby';
3+
import { IoIosArrowDown, IoIosArrowForward } from 'react-icons/io';
4+
5+
/**
6+
* Interactive Sidebar with toggleable categories.
7+
*
8+
* @requires categories of form: [ { name: "foobar", entires: []} ]
9+
*/
10+
const Sidebar = ({ categories = [], currentPathname }) => {
11+
const [selectedCategory, selectCategory] = useState(() => {
12+
for (const { categoryName, entries } of categories) {
13+
for (const entry of entries) {
14+
if (currentPathname.includes(entry.node.frontmatter.path)) {
15+
return categoryName;
16+
}
17+
}
18+
}
19+
return null;
20+
});
21+
22+
return (
23+
<nav className="sidebar">
24+
{categories.map(({ categoryName, entries }) => (
25+
<Fragment key={categoryName}>
26+
<button
27+
onClick={() =>
28+
selectCategory(
29+
selectedCategory === categoryName ? null : categoryName
30+
)
31+
}
32+
className="sidebar-category"
33+
>
34+
{categoryName}
35+
<IoIosArrowDown
36+
className="arrow"
37+
style={{
38+
display: selectedCategory === categoryName ? 'block' : 'none',
39+
}}
40+
/>
41+
<IoIosArrowForward
42+
className="arrow"
43+
style={{
44+
display: selectedCategory === categoryName ? 'none' : 'block',
45+
}}
46+
/>
47+
</button>
48+
<ul
49+
id={categoryName}
50+
name="Category"
51+
className="list-unstyled components show"
52+
style={{
53+
display: selectedCategory === categoryName ? 'block' : 'none',
54+
}}
55+
>
56+
{entries.map((element) => (
57+
<li
58+
key={element.node.frontmatter.title}
59+
className="sidebar-element"
60+
>
61+
<Link
62+
to={`/integrations/${element.node.frontmatter.path}`}
63+
activeClassName="active-Link"
64+
>
65+
{element.node.frontmatter.title}
66+
</Link>
67+
</li>
68+
))}
69+
</ul>
70+
</Fragment>
71+
))}
72+
</nav>
73+
);
74+
};
75+
76+
export default Sidebar;

0 commit comments

Comments
 (0)