gatsby-core-theme 1.6.19 → 1.6.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
## [1.6.20](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v1.6.19...v1.6.20) (2021-12-07)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* close menu onclick a link ([ce4d9bb](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ce4d9bbf8733bdbe3b09f7fd84226e6a084b42a7))
|
|
7
|
+
* implement for all core sites ([e5c46c0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e5c46c0bee4cf5555990d7c9c5d53bc43a2c6722))
|
|
8
|
+
* small issue ([30fd7e3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/30fd7e305935a00ec514321a5ca8e5a79545681c))
|
|
9
|
+
* small issue ([c1c29ce](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c1c29cedca7be589e2b3f23a7d25a399f1cb7ca5))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Code Refactoring
|
|
13
|
+
|
|
14
|
+
* add custom styles to menu ([f686a60](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f686a6059786b6c4f43cf24041f383a5bd19c0d7))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
* Merge branch 'tm-navigation-sticky' into 'master' ([0593868](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/05938683ca72db7677d3052f72fadbc26a2db613))
|
|
18
|
+
* Merge branch 'navigation-menu' into 'master' ([d812530](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d8125309b039694c6e35b54d3629134697b407f4))
|
|
19
|
+
|
|
1
20
|
## [1.6.19](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v1.6.18...v1.6.19) (2021-12-06)
|
|
2
21
|
|
|
3
22
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
|
1
|
+
import React, { useState, useEffect, useContext } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import Link from '~hooks/link';
|
|
4
4
|
import useIsMobile from '~hooks/useIsMobile';
|
|
5
5
|
import ConditionalWrapper from '~atoms/conditional-wrapper';
|
|
6
6
|
import { imagePrettyUrl } from '~helpers/getters';
|
|
7
|
+
import { NavigationContext } from '~organisms/navigation/navigationContext';
|
|
7
8
|
|
|
8
9
|
import styles from './item.module.scss';
|
|
9
10
|
|
|
@@ -21,6 +22,8 @@ export default function Item({
|
|
|
21
22
|
const [active, setActive] = useState('');
|
|
22
23
|
const [opened, setOpened] = useState(false);
|
|
23
24
|
|
|
25
|
+
const { setShowMenu } = useContext(NavigationContext);
|
|
26
|
+
|
|
24
27
|
useEffect(() => {
|
|
25
28
|
const url = typeof window !== 'undefined' ? new URL(window.location.href) : '';
|
|
26
29
|
setActive(
|
|
@@ -28,6 +31,10 @@ export default function Item({
|
|
|
28
31
|
);
|
|
29
32
|
}, [active, item]);
|
|
30
33
|
|
|
34
|
+
const handleClose = () => {
|
|
35
|
+
setShowMenu(false);
|
|
36
|
+
};
|
|
37
|
+
|
|
31
38
|
const toggleDropDown = (e) => {
|
|
32
39
|
e.target.classList.toggle(styles.active);
|
|
33
40
|
setOpened(e.target.classList.contains(styles.active));
|
|
@@ -84,6 +91,7 @@ export default function Item({
|
|
|
84
91
|
title={item.title}
|
|
85
92
|
rel={item.nofollow && 'nofollow'}
|
|
86
93
|
aria-label={`${item?.title} link`}
|
|
94
|
+
onClick={handleClose}
|
|
87
95
|
>
|
|
88
96
|
<ItemImage />
|
|
89
97
|
{item.title}
|
|
@@ -27,6 +27,7 @@ const Menu = ({
|
|
|
27
27
|
},
|
|
28
28
|
},
|
|
29
29
|
gtmClass = '',
|
|
30
|
+
customStyles,
|
|
30
31
|
}) => {
|
|
31
32
|
let menuObject;
|
|
32
33
|
|
|
@@ -62,7 +63,10 @@ const Menu = ({
|
|
|
62
63
|
return (
|
|
63
64
|
<div className={styles.menuContainer}>
|
|
64
65
|
<MenuIcon onClick={handleMenuIconClick} gtmClass="main-menu-gtm" />
|
|
65
|
-
<ul
|
|
66
|
+
<ul
|
|
67
|
+
ref={menuListRef}
|
|
68
|
+
className={`${menuListClasses} ${showMenu && styles.show} ${styles[customStyles]}`}
|
|
69
|
+
>
|
|
66
70
|
{menuObject &&
|
|
67
71
|
menuObject.children.map((child) => {
|
|
68
72
|
return (
|
|
@@ -113,6 +117,7 @@ Menu.propTypes = {
|
|
|
113
117
|
}).isRequired,
|
|
114
118
|
menu: PropTypes.string.isRequired,
|
|
115
119
|
gtmClass: PropTypes.string,
|
|
120
|
+
customStyles: PropTypes.string,
|
|
116
121
|
};
|
|
117
122
|
|
|
118
123
|
export default Menu;
|
|
@@ -33,6 +33,7 @@ const Navigation = ({
|
|
|
33
33
|
},
|
|
34
34
|
sticky = true,
|
|
35
35
|
template,
|
|
36
|
+
customStyles,
|
|
36
37
|
}) => {
|
|
37
38
|
const navRef = useRef(React.createRef());
|
|
38
39
|
const showMenu = template !== 'ppc';
|
|
@@ -72,7 +73,13 @@ const Navigation = ({
|
|
|
72
73
|
</Link>
|
|
73
74
|
{showMenu && (
|
|
74
75
|
<>
|
|
75
|
-
<Menu
|
|
76
|
+
<Menu
|
|
77
|
+
section={section}
|
|
78
|
+
menu={menu}
|
|
79
|
+
options={options}
|
|
80
|
+
customStyles={customStyles}
|
|
81
|
+
gtmClass="main-menu-gtm"
|
|
82
|
+
/>
|
|
76
83
|
{hasSearch && <Search className={styles.search} searchIcon={searchIcon} />}
|
|
77
84
|
</>
|
|
78
85
|
)}
|
|
@@ -116,6 +123,7 @@ Navigation.propTypes = {
|
|
|
116
123
|
}),
|
|
117
124
|
}),
|
|
118
125
|
sticky: PropTypes.bool,
|
|
126
|
+
customStyles: PropTypes.string,
|
|
119
127
|
};
|
|
120
128
|
|
|
121
129
|
export default Navigation;
|