@comicrelief/component-library 8.12.0 → 8.13.0

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.
Files changed (103) hide show
  1. package/README.md +12 -0
  2. package/dist/components/Atoms/SocialIcons/Icon/Icon.js +50 -8
  3. package/dist/components/Atoms/SocialIcons/SocialIcons.js +2 -1
  4. package/dist/components/Atoms/SocialIcons/SocialIcons.md +9 -6
  5. package/dist/components/Atoms/SocialIcons/Utils/Links.js +8 -4
  6. package/dist/components/Atoms/SocialIcons/__snapshots__/SocialIcons.test.js.snap +15 -117
  7. package/dist/components/Molecules/Logos/Logos.js +37 -15
  8. package/dist/components/Molecules/ShareButton/ShareButton.js +2 -1
  9. package/dist/components/Molecules/ShareButton/ShareButton.test.js +2 -2
  10. package/dist/components/Organisms/Footer/Nav/Nav.js +3 -3
  11. package/dist/components/Organisms/Footer/__snapshots__/Footer.test.js.snap +155 -189
  12. package/dist/components/Organisms/Header/Header.md +4 -0
  13. package/dist/components/Organisms/Header/HeaderNav/HeaderNav.js +163 -0
  14. package/dist/components/Organisms/Header/HeaderNav/HeaderNav.style.js +237 -0
  15. package/dist/components/Organisms/Header/HeaderNav/Menu-Group-Icon.svg +3 -0
  16. package/dist/components/Organisms/Header/HeaderNav/arrow-right.png +0 -0
  17. package/dist/components/Organisms/Header/HeaderNav/arrow.svg +6 -0
  18. package/dist/components/Organisms/Header/HeaderNav/chevron-down.svg +3 -0
  19. package/dist/components/Organisms/Header/Nav/Nav.js +3 -3
  20. package/dist/components/Organisms/Header/annoying.css +14 -0
  21. package/dist/components/Organisms/Header/assets/Post.svg +3 -0
  22. package/dist/components/Organisms/Header/data/data-extended.js +236 -0
  23. package/dist/components/Organisms/Header/data/data-live.js +126 -0
  24. package/dist/components/Organisms/Header2025/Burger/BurgerMenu.js +28 -0
  25. package/dist/components/Organisms/Header2025/Burger/BurgerMenu.style.js +76 -0
  26. package/dist/components/Organisms/Header2025/Header2025.js +40 -0
  27. package/dist/components/Organisms/Header2025/Header2025.md +554 -0
  28. package/dist/components/Organisms/Header2025/Header2025.style.js +72 -0
  29. package/dist/components/Organisms/Header2025/HeaderNav2025/HeaderNav2025.js +175 -0
  30. package/dist/components/Organisms/Header2025/HeaderNav2025/HeaderNav2025.style.js +308 -0
  31. package/dist/components/Organisms/Header2025/HeaderNav2025/HeaderNavItem2025.js +79 -0
  32. package/dist/components/Organisms/Header2025/HeaderNav2025/Menu-Group-Icon.svg +3 -0
  33. package/dist/components/Organisms/Header2025/HeaderNav2025/MoreNav.js +93 -0
  34. package/dist/components/Organisms/Header2025/HeaderNav2025/MoreNav.style.js +108 -0
  35. package/dist/components/Organisms/Header2025/HeaderNav2025/arrow-right.png +0 -0
  36. package/dist/components/Organisms/Header2025/HeaderNav2025/arrow.svg +6 -0
  37. package/dist/components/Organisms/Header2025/HeaderNav2025/chevron-down.svg +3 -0
  38. package/dist/components/Organisms/Header2025/annoying.css +14 -0
  39. package/dist/components/Organisms/Header2025/assets/PayIn.svg +3 -0
  40. package/dist/components/Organisms/Header2025/assets/Post.svg +3 -0
  41. package/dist/components/Organisms/Header2025/assets/icon--mail--2023.svg +3 -0
  42. package/dist/components/Organisms/Header2025/assets/icon--search--2023.svg +3 -0
  43. package/dist/components/Organisms/Header2025/assets/icon--shop--2023.svg +3 -0
  44. package/dist/components/Organisms/Header2025/data/data-extended.js +236 -0
  45. package/dist/components/Organisms/Header2025/data/data-live.js +126 -0
  46. package/dist/components/Organisms/Header2025/data/data.js +156 -0
  47. package/dist/components/Organisms/Header2025/header2025.test.js +25 -0
  48. package/dist/index.js +7 -0
  49. package/dist/styleguide/data/data.js +19 -19
  50. package/dist/theme/shared/allBreakpoints.js +1 -0
  51. package/dist/utils/navHelper.js +24 -2
  52. package/package.json +1 -1
  53. package/playwright.config.js +13 -6
  54. package/src/components/Atoms/SocialIcons/Icon/Icon.js +84 -5
  55. package/src/components/Atoms/SocialIcons/SocialIcons.js +1 -0
  56. package/src/components/Atoms/SocialIcons/SocialIcons.md +9 -6
  57. package/src/components/Atoms/SocialIcons/Utils/Links.js +8 -4
  58. package/src/components/Atoms/SocialIcons/__snapshots__/SocialIcons.test.js.snap +15 -117
  59. package/src/components/Molecules/Logos/Logos.js +35 -15
  60. package/src/components/Molecules/ShareButton/ShareButton.js +1 -0
  61. package/src/components/Molecules/ShareButton/ShareButton.test.js +8 -32
  62. package/src/components/Organisms/Footer/Nav/Nav.js +2 -2
  63. package/src/components/Organisms/Footer/__snapshots__/Footer.test.js.snap +155 -189
  64. package/src/components/Organisms/Header/Header.md +4 -0
  65. package/src/components/Organisms/Header/HeaderNav/HeaderNav.js +213 -0
  66. package/src/components/Organisms/Header/HeaderNav/HeaderNav.style.js +391 -0
  67. package/src/components/Organisms/Header/HeaderNav/Menu-Group-Icon.svg +3 -0
  68. package/src/components/Organisms/Header/HeaderNav/arrow-right.png +0 -0
  69. package/src/components/Organisms/Header/HeaderNav/arrow.svg +6 -0
  70. package/src/components/Organisms/Header/HeaderNav/chevron-down.svg +3 -0
  71. package/src/components/Organisms/Header/Nav/Nav.js +1 -1
  72. package/src/components/Organisms/Header/annoying.css +14 -0
  73. package/src/components/Organisms/Header/assets/Post.svg +3 -0
  74. package/src/components/Organisms/Header/data/data-extended.js +280 -0
  75. package/src/components/Organisms/Header/data/data-live.js +149 -0
  76. package/src/components/Organisms/Header2025/Burger/BurgerMenu.js +28 -0
  77. package/src/components/Organisms/Header2025/Burger/BurgerMenu.style.js +99 -0
  78. package/src/components/Organisms/Header2025/Header2025.js +62 -0
  79. package/src/components/Organisms/Header2025/Header2025.md +554 -0
  80. package/src/components/Organisms/Header2025/Header2025.style.js +131 -0
  81. package/src/components/Organisms/Header2025/HeaderNav2025/HeaderNav2025.js +192 -0
  82. package/src/components/Organisms/Header2025/HeaderNav2025/HeaderNav2025.style.js +462 -0
  83. package/src/components/Organisms/Header2025/HeaderNav2025/HeaderNavItem2025.js +142 -0
  84. package/src/components/Organisms/Header2025/HeaderNav2025/Menu-Group-Icon.svg +3 -0
  85. package/src/components/Organisms/Header2025/HeaderNav2025/MoreNav.js +171 -0
  86. package/src/components/Organisms/Header2025/HeaderNav2025/MoreNav.style.js +190 -0
  87. package/src/components/Organisms/Header2025/HeaderNav2025/arrow-right.png +0 -0
  88. package/src/components/Organisms/Header2025/HeaderNav2025/arrow.svg +6 -0
  89. package/src/components/Organisms/Header2025/HeaderNav2025/chevron-down.svg +3 -0
  90. package/src/components/Organisms/Header2025/annoying.css +14 -0
  91. package/src/components/Organisms/Header2025/assets/PayIn.svg +3 -0
  92. package/src/components/Organisms/Header2025/assets/Post.svg +3 -0
  93. package/src/components/Organisms/Header2025/assets/icon--mail--2023.svg +3 -0
  94. package/src/components/Organisms/Header2025/assets/icon--search--2023.svg +3 -0
  95. package/src/components/Organisms/Header2025/assets/icon--shop--2023.svg +3 -0
  96. package/src/components/Organisms/Header2025/data/data-extended.js +280 -0
  97. package/src/components/Organisms/Header2025/data/data-live.js +149 -0
  98. package/src/components/Organisms/Header2025/data/data.js +184 -0
  99. package/src/components/Organisms/Header2025/header2025.test.js +23 -0
  100. package/src/index.js +1 -0
  101. package/src/styleguide/data/data.js +19 -19
  102. package/src/theme/shared/allBreakpoints.js +1 -0
  103. package/src/utils/navHelper.js +24 -1
@@ -102,6 +102,7 @@ const [success, setSuccess] = React.useState(false);
102
102
  href="/search"
103
103
  brand="comicrelief"
104
104
  tabIndex="0"
105
+ id="search"
105
106
  />
106
107
  </div>
107
108
  </>
@@ -159,6 +160,7 @@ const [success, setSuccess] = React.useState(false);
159
160
  href="/search"
160
161
  brand="comicrelief"
161
162
  tabIndex="0"
163
+ id="search"
162
164
  />
163
165
  </div>
164
166
  <div>
@@ -170,6 +172,7 @@ const [success, setSuccess] = React.useState(false);
170
172
  href="https://shop.comicrelief.com"
171
173
  brand="comicrelief"
172
174
  tabIndex="0"
175
+ id="shop"
173
176
  />
174
177
  </div>
175
178
  <div>
@@ -181,6 +184,7 @@ const [success, setSuccess] = React.useState(false);
181
184
  href="https://donation.comicrelief.com/?cartId=rnd23-fundraisingpayin"
182
185
  brand="comicrelief"
183
186
  tabIndex="0"
187
+ id="payin"
184
188
  />
185
189
  </div>
186
190
  </>
@@ -0,0 +1,213 @@
1
+ import React, { useState, useEffect, useCallback } from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ import Text from '../../../Atoms/Text/Text';
5
+ import BurgerMenu from '../Burger/BurgerMenu';
6
+ import { breakpointValues } from '../../../../theme/shared/allBreakpoints';
7
+ import { NavHelper } from '../../../../utils/navHelper';
8
+ import { InternalLinkHelper } from '../../../../utils/internalLinkHelper';
9
+ import allowListed from '../../../../utils/allowListed';
10
+ import menuGroupIcon from './Menu-Group-Icon.svg';
11
+
12
+ import {
13
+ Nav,
14
+ NavMenu,
15
+ NavItem,
16
+ NavLink,
17
+ SubNavMenu,
18
+ SubNavItem,
19
+ SubNavLink,
20
+ ChevronWrapper,
21
+ NavMetaIcons,
22
+ DonateButtonWrapperBottom
23
+ } from './HeaderNav.style';
24
+
25
+ const HeaderNav = ({
26
+ navItems = {}, metaIcons, donateButton = null
27
+ }) => {
28
+ const { menuGroups } = navItems;
29
+ const [isExpandable, setIsExpandable] = useState(false);
30
+ const [isSubMenuOpen, setIsSubMenuOpen] = useState({});
31
+ const [isTabFocussed, setIsTabFocussed] = useState({});
32
+ const [isNotDesktop, setIsNotDesktop] = useState(null);
33
+ const theseGroups = null;
34
+
35
+ const toggleBurgerMenu = event => {
36
+ event.preventDefault();
37
+ setIsExpandable(!isExpandable);
38
+ };
39
+
40
+ const toggleSubMenu = (e, item) => {
41
+ e.preventDefault();
42
+ setIsSubMenuOpen({ [item]: !isSubMenuOpen[item] });
43
+ };
44
+
45
+ // Handle tab key on menu nav
46
+ const keyPressed = item => () => {
47
+ window.onkeyup = e => {
48
+ // Specifies the tab key:
49
+ if (e.which === 9) {
50
+ // If the currently tabbed-to element is our item, do something
51
+ if (e.target.querySelector('span') && e.target.querySelector('span').innerText === item) {
52
+ setIsTabFocussed({ [item]: !isTabFocussed[item] });
53
+ } else if (!e.target.querySelector('span')) {
54
+ setIsTabFocussed({});
55
+ }
56
+ }
57
+ };
58
+ };
59
+
60
+ useEffect(() => {
61
+ // Set desktopFlag on
62
+ setIsNotDesktop(window.innerWidth < breakpointValues.Nav);
63
+ window.addEventListener('onkeyup', setIsTabFocussed);
64
+
65
+ return () => {
66
+ window.removeEventListener('onkeyup', setIsTabFocussed);
67
+ };
68
+ }, [menuGroups]);
69
+
70
+ // Custom function to let us update the nav dynamically:
71
+ const screenResizeNav = useCallback(() => {
72
+ const screenSize = typeof window !== 'undefined' ? window.innerWidth : null;
73
+ const isCurrentlyNotDesktop = window.innerWidth < breakpointValues.Nav;
74
+
75
+ if (screenSize !== null && (isNotDesktop !== isCurrentlyNotDesktop)) {
76
+ setIsNotDesktop(isCurrentlyNotDesktop);
77
+ }
78
+ }, [isNotDesktop]);
79
+
80
+ useEffect(() => {
81
+ // Hook into browser's own onresize event to call our custom wrapper function:
82
+ if (typeof window !== 'undefined') window.onresize = screenResizeNav;
83
+ }, [screenResizeNav]);
84
+
85
+ return (
86
+ <>
87
+ <Nav aria-label="main-menu" isExpandable={isExpandable} role="navigation">
88
+ <Text id="main-menu" tag="h2">
89
+ Main navigation
90
+ </Text>
91
+
92
+ <NavMenu role="menubar">
93
+ {theseGroups.map((group, index) => {
94
+ /* Grab the first links properties to use for our parent/button */
95
+ const thisFirstChild = group.links[0];
96
+ const thisID = group.id;
97
+
98
+ /* Determine which field represents our url path */
99
+ let thisUrl = NavHelper(thisFirstChild);
100
+ const relNoopener = (!allowListed(thisUrl) && 'noopener') || null;
101
+ const hasSubMenu = group.links && group.links.length > 1;
102
+ const hasPopUp = hasSubMenu ? 'true' : null;
103
+ thisUrl = InternalLinkHelper(thisUrl);
104
+
105
+ // Renders the first menugroup item to act as the parent; a button for the dropdown
106
+ // on mobile, a clickable LINK on desktop but hover to reveal the submenu
107
+ return (
108
+ <NavItem
109
+ role="none"
110
+ key={`${thisID}-item`}
111
+ index={index}
112
+ isSubMenuOpen={!!isSubMenuOpen[thisID]}
113
+ >
114
+ {isNotDesktop ? (
115
+ <NavLink
116
+ href={hasPopUp ? '#' : thisUrl}
117
+ inline
118
+ rel={relNoopener}
119
+ aria-expanded={!!isSubMenuOpen[thisID]}
120
+ aria-haspopup={hasPopUp}
121
+ onClick={hasPopUp ? e => toggleSubMenu(e, thisID) : null}
122
+ onKeyUp={keyPressed(group.title)}
123
+ role="button"
124
+ key={`${thisID}-link`}
125
+ >
126
+ {thisFirstChild.title}
127
+ {hasSubMenu && (
128
+ <ChevronWrapper>
129
+ <img src={menuGroupIcon} alt="chevron down icon" />
130
+ </ChevronWrapper>
131
+ )}
132
+ </NavLink>
133
+ ) : (
134
+ <Text>
135
+ <NavLink
136
+ href={thisUrl}
137
+ inline
138
+ rel={relNoopener}
139
+ aria-haspopup={hasPopUp}
140
+ onKeyUp={keyPressed(group.title)}
141
+ key={thisID}
142
+ >
143
+ {thisFirstChild.title}
144
+ {hasSubMenu
145
+ && (
146
+ <ChevronWrapper>
147
+ <img src={menuGroupIcon} alt="chevron down icon" />
148
+ </ChevronWrapper>
149
+ )
150
+ }
151
+ </NavLink>
152
+ </Text>
153
+ )}
154
+
155
+ {/* Second level of the navigation (ul tag): Child(ren) */}
156
+ {/* Used for BOTH nav types */}
157
+ {hasSubMenu && (
158
+ <SubNavMenu
159
+ role="list"
160
+ isFocussed={!!isTabFocussed[group.title]}
161
+ isSubMenuOpen={!!isSubMenuOpen[thisID]}
162
+ key={thisID}
163
+ >
164
+ {group.links.map((child, childIndex) => {
165
+ let thisSubUrl = NavHelper(child);
166
+ thisSubUrl = InternalLinkHelper(thisSubUrl);
167
+
168
+ // Skip the very first child on desktop, since
169
+ // we've already made a 'button' version above:
170
+ if (childIndex === 0 && !isNotDesktop) return null;
171
+
172
+ // Otherwise, render out as usual:
173
+ return (
174
+ <SubNavItem key={thisSubUrl}>
175
+ <SubNavLink href={thisSubUrl} inline role="menuitem">
176
+ <Text>{child.title}</Text>
177
+ </SubNavLink>
178
+ </SubNavItem>
179
+ );
180
+ })}
181
+ </SubNavMenu>
182
+ )}
183
+ </NavItem>
184
+ );
185
+ })}
186
+
187
+ </NavMenu>
188
+
189
+ {/* These are only shown on the non-desktop view; the desktop nav renders
190
+ these in the parent Header component to suit the design layout */}
191
+ <NavMetaIcons isHeader data-testid="meta-icons--mobile">
192
+ {metaIcons}
193
+ </NavMetaIcons>
194
+ <DonateButtonWrapperBottom data-testid="donate-button--mobile">
195
+ {donateButton}
196
+ </DonateButtonWrapperBottom>
197
+ </Nav>
198
+ <BurgerMenu toggle={toggleBurgerMenu} isExpandable={isExpandable}>
199
+ Open
200
+ </BurgerMenu>
201
+ </>
202
+ );
203
+ };
204
+
205
+ HeaderNav.propTypes = {
206
+ navItems: PropTypes.objectOf(PropTypes.shape),
207
+ metaIcons: PropTypes.node.isRequired,
208
+ // As this is rendered in both the Header AND the Nav, just passing
209
+ // the same prop through to here:
210
+ donateButton: PropTypes.node
211
+ };
212
+
213
+ export default HeaderNav;
@@ -0,0 +1,391 @@
1
+ import styled from 'styled-components';
2
+
3
+ import Link from '../../../Atoms/Link/Link';
4
+ import hideVisually from '../../../../theme/shared/hideVisually';
5
+ import zIndex from '../../../../theme/shared/zIndex';
6
+ import Arrow from './arrow-right.png';
7
+
8
+ const transitionDuration = 0.2;
9
+
10
+ const NavLinkClass = styled(Link)`
11
+ display: inline-block;
12
+ border: 0;
13
+ padding: 25px;
14
+ line-height: 1rem;
15
+ height: auto;
16
+ font-weight: 700;
17
+ width: 100%;
18
+ color: ${({ theme }) => theme.color('black')};
19
+ transition: color ${transitionDuration}s ease;
20
+
21
+ :hover,
22
+ :focus,
23
+ :focus-within {
24
+ border: 0;
25
+ color: ${({ theme }) => theme.color('red')};
26
+ font-weight: inherit;
27
+ }
28
+ `;
29
+
30
+ /**
31
+ * Navigation menu
32
+ */
33
+ const Nav = styled.nav`
34
+ display: ${({ isExpandable }) => (isExpandable ? 'block' : 'none')};
35
+ width: 100%;
36
+ position: absolute;
37
+ top: 75px;
38
+ left: 0;
39
+ ${zIndex('higher')};
40
+ background-color: ${({ theme }) => theme.color('white')};
41
+ box-shadow: 0px 20px 20px 5px rgba(0, 0, 0, 0.25);
42
+
43
+ @media ${({ theme }) => theme.allBreakpoints('M')} {
44
+ width: 50%;
45
+ right: 0;
46
+ left: inherit;
47
+ box-shadow: -20px 15px 20px 0px rgba(0, 0, 0, 0.25);
48
+ }
49
+
50
+ @media ${({ theme }) => theme.allBreakpoints('Nav')} {
51
+ ${zIndex('medium')};
52
+ position: relative;
53
+ top: 0;
54
+ display: block;
55
+ margin: 0 10px;
56
+ width: auto;
57
+ height: 100%;
58
+ box-shadow: none;
59
+ }
60
+ > h2 {
61
+ ${hideVisually};
62
+ }
63
+ `;
64
+
65
+ /**
66
+ * Sub Navigation Menu (second level)
67
+ */
68
+ const SubNavMenu = styled.ul`
69
+ visibility: ${({ isSubMenuOpen }) => (isSubMenuOpen ? 'visible' : 'hidden')};
70
+ display: ${({ isSubMenuOpen }) => (isSubMenuOpen ? 'flex' : 'none')};
71
+ padding: 0;
72
+ position: relative;
73
+ list-style: none outside;
74
+ left: 0;
75
+ top: 0;
76
+ flex-direction: column;
77
+ justify-content: center;
78
+ align-items: center;
79
+ background-color: ${({ theme }) => theme.color('white')};
80
+ overflow: hidden;
81
+ border: 1px solid ${({ theme }) => theme.color('grey_medium')};
82
+
83
+ // DESKTOP:
84
+ @media ${({ theme }) => theme.allBreakpoints('Nav')} {
85
+ display: flex;
86
+ visibility: ${({ isFocussed }) => (isFocussed ? 'visible' : 'hidden')};
87
+ width: 330px;
88
+ height: auto;
89
+ padding: 0;
90
+ position: absolute;
91
+ top: 88px;
92
+ left: -5px;
93
+ border-radius: 0 0 25px 25px;
94
+ transition: opacity ${transitionDuration}s ease;
95
+ opacity: 0;
96
+ box-shadow: 0px 20px 20px 5px rgba(0, 0, 0, 0.25);
97
+ }
98
+ `;
99
+
100
+ /**
101
+ * Sub Menu list items
102
+ */
103
+ const SubNavItem = styled.li`
104
+ padding: 0;
105
+ height: 100%;
106
+ width: 100%;
107
+ border-top: 1px solid ${({ theme }) => theme.color('grey_medium')};;
108
+ position: relative;
109
+ transition: background-color ${transitionDuration}s ease;
110
+
111
+ &:first-of-type {
112
+ border-top: none;
113
+ }
114
+
115
+ span {
116
+ font-weight: 100;
117
+ }
118
+
119
+ :hover,
120
+ :focus,
121
+ :focus-within {
122
+ background-color: ${({ theme }) => theme.color('grey_extra_light')};
123
+ + span {
124
+ border-bottom: 0;
125
+ padding-bottom: 2px;
126
+ color: ${({ theme }) => theme.color('red')};
127
+ }
128
+ }
129
+ `;
130
+
131
+ /**
132
+ * Sub menu link item
133
+ */
134
+ const SubNavLink = styled(NavLinkClass)`
135
+ padding: 20px 25px 18px 40px;
136
+ color: ${({ theme }) => theme.color('black')};
137
+ height: auto;
138
+ position: relative;
139
+ `;
140
+
141
+ /**
142
+ * Navigation Menu (first level)
143
+ */
144
+ const NavMenu = styled.ul`
145
+ background-color: ${({ theme }) => theme.color('white')};
146
+ list-style: none outside;
147
+ padding: 0;
148
+ margin: 0;
149
+
150
+ @media ${({ theme }) => theme.allBreakpoints('Nav')} {
151
+ position: relative;
152
+ display: flex;
153
+ flex-wrap: wrap;
154
+ align-items: center;
155
+ justify-content: flex-start;
156
+ background-color: ${({ theme }) => theme.color('white')};
157
+ }
158
+ `;
159
+
160
+ /**
161
+ * Menu item link
162
+ */
163
+ const NavLink = styled(NavLinkClass)`
164
+ display: flex;
165
+ gap: 4px;
166
+ font-family: ${({ theme }) => theme.fontFamilies(theme.font.regular)};
167
+ @media ${({ theme }) => theme.allBreakpoints('Nav')} {
168
+ padding: 10px 0;
169
+ padding: 10px 15px 15px 0;
170
+ height: auto;
171
+ :hover,
172
+ :focus-within,
173
+ :focus {
174
+ + ${SubNavMenu} {
175
+ display: flex;
176
+ opacity: 1;
177
+ }}
178
+ }
179
+ `;
180
+
181
+ /**
182
+ * Menu list items
183
+ */
184
+ const NavItem = styled.li`
185
+ ${zIndex('medium')};
186
+ position: relative;
187
+ font-weight: 700;
188
+ border-bottom: 1px solid ${({ theme }) => theme.color('grey_medium')};
189
+
190
+ li {
191
+ span {
192
+ border-bottom: none;
193
+ padding-bottom: 0;
194
+ }
195
+
196
+ :hover,
197
+ :focus,
198
+ :focus-within {
199
+ span {
200
+ border-bottom: none;
201
+ padding-bottom: 0;
202
+ }
203
+ }
204
+ }
205
+
206
+ // Chevron icon:
207
+ span > a > div {
208
+ transition: transform 0.35s cubic-bezier(0.41, 1.64, 0.41, 0.8);
209
+ }
210
+
211
+ :hover,
212
+ :focus,
213
+ :focus-within {
214
+ li {
215
+ span {
216
+ border-bottom: none;
217
+ padding-bottom: 0;
218
+ }
219
+ }
220
+
221
+ // Chevron icon:
222
+ span > a {
223
+ color: ${({ theme }) => theme.color('red')};
224
+ > div {
225
+ transform: rotate(-180deg);
226
+ img {
227
+ // Use fancy filter to colour 'img' version of SVG
228
+ filter: invert(0.5) sepia(1) saturate(100) hue-rotate(20deg);
229
+ }
230
+ }
231
+ }
232
+ }
233
+
234
+
235
+ @media ${({ theme }) => theme.allBreakpoints('Nav')} {
236
+ margin: 0 4px;
237
+ padding: 25px 5px;
238
+ border-bottom: none;
239
+
240
+ :hover,
241
+ :focus,
242
+ :focus-within {
243
+ > ${SubNavMenu}, :focus-within > ${SubNavMenu} {
244
+ visibility: visible;
245
+ opacity: 1;
246
+ display: flex;
247
+ }
248
+ }
249
+
250
+ :hover,
251
+ :focus,
252
+ :focus-within {
253
+ background-color: transparent;
254
+ ${zIndex('high')};
255
+
256
+ span {
257
+ border-bottom: 2px solid ${({ theme }) => theme.color('black')};
258
+ padding-bottom: 2px;
259
+ }
260
+
261
+ ${SubNavMenu} {
262
+ display: flex;
263
+ opacity: 1;
264
+ visibility: visible;
265
+ flex-direction: column;
266
+ }
267
+ }
268
+ }
269
+ `;
270
+
271
+ const ChevronWrapper = styled.div`
272
+ width: 16px;
273
+ position: absolute;
274
+ top: 20px;
275
+ right: 22px;
276
+ height: 16px;
277
+
278
+ img {
279
+ width: 100%;
280
+ display: block;
281
+ height: auto;
282
+ }
283
+
284
+ @media ${({ theme }) => theme.allBreakpoints('Nav')} {
285
+ position: absolute;
286
+ top: 10px;
287
+ right: 0;
288
+ width: 10px;
289
+ }
290
+ `;
291
+
292
+ // This represents the 'non-desktop'/mobile nav icons:
293
+ const NavMetaIcons = styled.div`
294
+ width: auto;
295
+ display: flex;
296
+ align-items: center;
297
+ flex-direction: column;
298
+ background-color: inherit;
299
+
300
+ > div {
301
+ height: 60px;
302
+ width: 100%;
303
+ display: flex;
304
+ border-bottom: 1px solid ${({ theme }) => theme.color('grey_medium')};
305
+
306
+ > a {
307
+ height: inherit;
308
+ width: 100%;
309
+ padding: 15px 20px;
310
+ position: relative;
311
+
312
+ &: after {
313
+ position: absolute;
314
+ right: 20px;
315
+ top: 50%;
316
+ transform: translateY(-50%);
317
+ content: "";
318
+ width: 20px;
319
+ height: 20px;
320
+ background-image: url(${Arrow});
321
+ background-size: 100%;
322
+ background-repeat: no-repeat;
323
+ }
324
+
325
+ img {
326
+ padding: 5px;
327
+ height: 35px;
328
+ width: 35px;
329
+ }
330
+
331
+ span {
332
+ transition: color 0.15s ease-out;
333
+ }
334
+
335
+ &:focus,
336
+ &:hover {
337
+ span {
338
+ color: ${({ theme }) => theme.color('red')};
339
+ }
340
+ }
341
+ }
342
+
343
+ &:first-child {
344
+ margin-top: 20px;
345
+ }
346
+ }
347
+
348
+ // Hide these when using non-mobile nav,
349
+ // just leaving the Header version in place
350
+ @media ${({ theme }) => theme.allBreakpoints('Nav')} {
351
+ display: none;
352
+ }
353
+ `;
354
+
355
+ const DonateButtonWrapperBottom = styled.div`
356
+ display: flex;
357
+ justify-content: center;
358
+ padding: 35px 20px;
359
+ background-color: inherit;
360
+
361
+ // Donate button
362
+ a {
363
+ width: calc(100% - 10px);
364
+ transition: width 0.35s cubic-bezier(0.5, 1.5, 0.5, 0.9);
365
+
366
+ &:hover,
367
+ &:focus {
368
+ width: 100%;
369
+ box-shadow: rgba(0, 0, 0, 0.1) 0 0 20px 0;
370
+ }
371
+ }
372
+
373
+ // Hide the 'Nav'-embedded version of the button when the nav
374
+ // goes FULL DESKTOP, leaving just the 'Header'-embedded example
375
+ @media ${({ theme }) => theme.allBreakpoints('Nav')} {
376
+ display: none;
377
+ }
378
+ `;
379
+
380
+ export {
381
+ Nav,
382
+ NavMenu,
383
+ NavItem,
384
+ NavLink,
385
+ SubNavMenu,
386
+ SubNavItem,
387
+ SubNavLink,
388
+ ChevronWrapper,
389
+ NavMetaIcons,
390
+ DonateButtonWrapperBottom
391
+ };
@@ -0,0 +1,3 @@
1
+ <svg width="14" height="24" viewBox="0 0 14 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M7 16.5002C6.744 16.5002 6.48849 16.4027 6.29299 16.2072L0.29288 10.207C-0.0976268 9.81649 -0.0976268 9.18347 0.29288 8.79296C0.683387 8.40245 1.3164 8.40245 1.70691 8.79296L7 14.0856L12.2931 8.79296C12.6836 8.40245 13.3166 8.40245 13.7071 8.79296C14.0976 9.18347 14.0976 9.81649 13.7071 10.207L7.70701 16.2072C7.51151 16.4027 7.256 16.5002 7 16.5002Z" fill="#222222"/>
3
+ </svg>
@@ -0,0 +1,6 @@
1
+ <svg
2
+ xmlns="http://www.w3.org/2000/svg"
3
+ viewBox="0 0 96 96"
4
+ >
5
+ <path transform="rotate(-180 47.998626708984375,48.00019836425781) " id="arrow" d="m90.871,50.776c-0.016,0.016 -0.026,0.036 -0.043,0.052l-32,32c-0.781,0.781 -1.804,1.172 -2.828,1.172s-2.047,-0.391 -2.829,-1.171a4,4 0 0 1 0,-5.657l25.172,-25.172l-70.343,0a4,4 0 0 1 0,-8l70.343,0l-25.172,-25.171a4,4 0 0 1 5.657,-5.657l32,32c0.016,0.016 0.027,0.036 0.043,0.052c0.167,0.172 0.321,0.357 0.455,0.557c0.069,0.104 0.118,0.216 0.176,0.325c0.065,0.121 0.138,0.236 0.191,0.364c0.057,0.137 0.09,0.279 0.13,0.42c0.032,0.109 0.074,0.214 0.097,0.327a4.017,4.017 0 0 1 0,1.568c-0.023,0.113 -0.065,0.217 -0.097,0.327c-0.041,0.141 -0.074,0.283 -0.13,0.42c-0.053,0.128 -0.126,0.243 -0.191,0.364c-0.059,0.109 -0.107,0.221 -0.176,0.325a4.035,4.035 0 0 1 -0.455,0.555z" />
6
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="bi bi-chevron-down" viewBox="0 0 16 16">
2
+ <path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"/>
3
+ </svg>
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
4
4
  import Text from '../../../Atoms/Text/Text';
5
5
  import BurgerMenu from '../Burger/BurgerMenu';
6
6
  import { breakpointValues } from '../../../../theme/shared/allBreakpoints';
7
- import NavHelper from '../../../../utils/navHelper';
7
+ import { NavHelper } from '../../../../utils/navHelper';
8
8
  import { InternalLinkHelper } from '../../../../utils/internalLinkHelper';
9
9
  import allowListed from '../../../../utils/allowListed';
10
10
  import chevronDown from './chevron-down.svg';
@@ -0,0 +1,14 @@
1
+ /* Overiding the crummy Styleguidest styles */
2
+ .rsg--preview-35 {
3
+ padding: 0 !important;
4
+ border: none !important;
5
+ }
6
+
7
+ .rsg--content-3 {
8
+ padding: 0 !important;
9
+ }
10
+
11
+ .rsg--header-11,
12
+ .rsg--tabs-12 {
13
+ display: none !important;;
14
+ }
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M23.404 5.91909C23.439 5.84409 23.4635 5.76309 23.479 5.67859C23.4825 5.65859 23.4875 5.63909 23.4895 5.61909C23.4915 5.60459 23.496 5.59109 23.497 5.57659C23.503 5.49709 23.497 5.41959 23.4855 5.34359C23.483 5.32809 23.4785 5.31409 23.475 5.29859C23.456 5.20659 23.4265 5.11859 23.3835 5.03709C23.381 5.03209 23.381 5.02659 23.378 5.02159C23.377 5.02009 23.3755 5.01859 23.3745 5.01709C23.3275 4.93259 23.267 4.85759 23.198 4.79009C23.185 4.77709 23.1725 4.76459 23.159 4.75259C23.0895 4.69109 23.013 4.63909 22.928 4.59859C22.916 4.59309 22.9035 4.58909 22.8915 4.58409C22.812 4.55009 22.7275 4.52609 22.6385 4.51359C22.626 4.51159 22.6145 4.50809 22.602 4.50709C22.593 4.50609 22.585 4.50309 22.576 4.50259L3.07601 3.00259C2.67651 2.97059 2.28551 3.19009 2.10401 3.55559C1.92301 3.92059 1.98201 4.35959 2.25251 4.66409L5.35251 8.15159L1.29051 9.02209C0.881009 9.11009 0.569009 9.44409 0.509509 9.85909C0.450509 10.2741 0.656509 10.6816 1.02551 10.8801L7.10151 14.1521L8.01551 19.1786C8.08201 19.5446 8.34601 19.8431 8.70101 19.9541C8.80001 19.9851 8.90051 20.0001 9.00001 20.0001C9.26101 20.0001 9.51651 19.8976 9.70701 19.7071L23.207 6.20709C23.2175 6.19659 23.2225 6.18209 23.233 6.17109C23.294 6.10509 23.349 6.03309 23.391 5.95159C23.396 5.94109 23.399 5.93009 23.404 5.91909ZM5.39301 5.18709L15.544 5.96809L7.60051 7.67009L5.39301 5.18709ZM9.64251 16.9436L8.98401 13.3211C8.93001 13.0221 8.74201 12.7636 8.47401 12.6196L4.36751 10.4081L19.3985 7.18709L9.64251 16.9436ZM3.00101 18.0001C2.63401 18.0001 2.28101 17.7976 2.10551 17.4471C1.85851 16.9531 2.05851 16.3526 2.55301 16.1051L4.55301 15.1051C5.04801 14.8571 5.64801 15.0586 5.89501 15.5526C6.14201 16.0466 5.94201 16.6471 5.44751 16.8946L3.44751 17.8946C3.30351 17.9666 3.15101 18.0001 3.00101 18.0001ZM6.70701 18.2931C7.09751 18.6836 7.09751 19.3166 6.70701 19.7071L4.70701 21.7071C4.51151 21.9026 4.25601 22.0001 4.00001 22.0001C3.74401 22.0001 3.48851 21.9026 3.29301 21.7071C2.90251 21.3166 2.90251 20.6836 3.29301 20.2931L5.29301 18.2931C5.68351 17.9026 6.31651 17.9026 6.70701 18.2931Z" fill="#222222"/>
3
+ </svg>