@comicrelief/component-library 8.13.0 → 8.13.1

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.
@@ -476,6 +476,117 @@ const successCopy = (
476
476
  initialState = { isSuccess: false };
477
477
  const [success, setSuccess] = React.useState(false);
478
478
 
479
+ <>
480
+ <Header2025
481
+ characterLimit={50}
482
+ navItems={data}
483
+ rotate="true"
484
+ donateButton={
485
+ <>
486
+ <Link color="red" type="button" href="/donation">
487
+ Donate
488
+ </Link>
489
+ </>
490
+ }
491
+ metaIcons={
492
+ <>
493
+ <div>
494
+ <Icon
495
+ icon={esuIcon}
496
+ title="Newsletter"
497
+ target="_blank"
498
+ role="button"
499
+ href="#"
500
+ brand="comicrelief"
501
+ tabIndex="0"
502
+ isHeader
503
+ id="esu"
504
+ />
505
+ </div>
506
+ <div>
507
+ <Icon
508
+ icon={payinIcon}
509
+ title="Pay in"
510
+ target="_blank"
511
+ role="button"
512
+ href="https://donation.comicrelief.com/?cartId=rnd23-fundraisingpayin"
513
+ brand="comicrelief"
514
+ tabIndex="0"
515
+ isHeader
516
+ id="payin"
517
+ />
518
+ </div>
519
+
520
+ <div>
521
+ <Icon
522
+ icon={shopIcon}
523
+ title="Shop"
524
+ target="_blank"
525
+ role="button"
526
+ href="https://shop.comicrelief.com"
527
+ brand="comicrelief"
528
+ tabIndex="0"
529
+ isHeader
530
+ id="shop"
531
+ />
532
+ </div>
533
+
534
+ <div>
535
+ <Icon
536
+ icon={searchIcon}
537
+ title="Search"
538
+ target="self"
539
+ role="button"
540
+ href="/search"
541
+ brand="comicrelief"
542
+ tabIndex="0"
543
+ isHeader
544
+ id="search"
545
+ />
546
+ </div>
547
+ </>
548
+ }
549
+ />
550
+ <div style={{height: "1000px", backgroundColor: "turquoise", width:"100%"}}>
551
+ <img style={{width: "100%", maxWidth:"1440px", margin: "0 auto", display: "block"}} src="https://images.ctfassets.net/zsfivwzfgl3t/ecqrPx7BesE3JsYR2ns0E/a374276ba6d8024b9cd7c6d27c911303/Manchester_Marathon.jpeg"/>
552
+ </div>
553
+ </>;
554
+ ```
555
+
556
+ # -
557
+ # Comic Relief minimal header
558
+
559
+ ```js
560
+ import data from './data/data-live--minimal';
561
+ import Link from '../../Atoms/Link/Link';
562
+ import searchIcon from './assets/icon--search--2023.svg';
563
+ import shopIcon from './assets/icon--shop--2023.svg';
564
+ import payinIcon from './assets/PayIn.svg';
565
+ import esuIcon from './assets/Post.svg';
566
+
567
+ import Icon from '../../Atoms/SocialIcons/Icon/Icon';
568
+ import RichText from '../../Atoms/RichText/RichText';
569
+
570
+ const title = 'Stay in the know!';
571
+ const topCopy = (
572
+ <RichText
573
+ markup={`<p>Get regular email updates and info on what we're up to!</p>`}
574
+ />
575
+ );
576
+ const privacyCopy = (
577
+ <RichText
578
+ markup={`<p>Our <a class="link link--white inline" href="/privacy-notice">Privacy Policy</a> describes how we handle and protect your information.<br><br>If you are under 18, please make sure you have your parents’ permission before providing us with any personal details.</p>`}
579
+ />
580
+ );
581
+ const successCopy = (
582
+ <RichText
583
+ markup={`<p>Thanks! Your first email will be with you shortly</p>`}
584
+ />
585
+ );
586
+
587
+ initialState = { isSuccess: false };
588
+ const [success, setSuccess] = React.useState(false);
589
+
479
590
  <>
480
591
  <Header2025
481
592
  characterLimit={50}
@@ -91,7 +91,8 @@ const HeaderNav2025 = _ref => {
91
91
  if (currentScreenWidth !== null && isNotDesktop !== isCurrentlyNotDesktop) {
92
92
  // If we've changed from desktop to not, remove any previously-attached MoreNav event
93
93
  // listeners, BEFORE we update the flag that'd remove the elements from the DOM:
94
- if (isCurrentlyNotDesktop) {
94
+ if (isCurrentlyNotDesktop && processedItems.moreNavGroups.length) {
95
+ // HERE CHERE
95
96
  document.getElementById('more-nav-ul').removeEventListener('mouseleave', resetMoreNavMouse);
96
97
  }
97
98
 
@@ -100,7 +101,7 @@ const HeaderNav2025 = _ref => {
100
101
 
101
102
  // And since we've changed breakpoints, use these flags
102
103
  // to determine if we should render the More nav or not,
103
- setShowMoreNav(Boolean(!isCurrentlyNotDesktop && processedItems.moreNavGroups));
104
+ setShowMoreNav(Boolean(!isCurrentlyNotDesktop && processedItems.moreNavGroups.length));
104
105
  }
105
106
  }, [isNotDesktop, processedItems]);
106
107
 
@@ -155,14 +156,14 @@ const HeaderNav2025 = _ref => {
155
156
  internalLinkHelper: _internalLinkHelper.InternalLinkHelper,
156
157
  relNoopener: relNoopener
157
158
  });
158
- }), showMoreNav && /*#__PURE__*/_react.default.createElement(_MoreNav.default, {
159
+ }), showMoreNav ? /*#__PURE__*/_react.default.createElement(_MoreNav.default, {
159
160
  processedItems: processedItems,
160
161
  openedSubMenu: openedSubMenu,
161
162
  toggleSubMenu: toggleSubMenu,
162
163
  navHelper: _navHelper.NavHelper,
163
164
  allowListed: _allowListed.default,
164
165
  internalLinkHelper: _internalLinkHelper.InternalLinkHelper
165
- })), /*#__PURE__*/_react.default.createElement(_HeaderNav.NavMetaIcons, {
166
+ }) : null), /*#__PURE__*/_react.default.createElement(_HeaderNav.NavMetaIcons, {
166
167
  isHeader: true,
167
168
  "data-testid": "meta-icons--mobile"
168
169
  }, metaIcons), /*#__PURE__*/_react.default.createElement(_HeaderNav.DonateButtonWrapperBottom, {
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _default = exports.default = {
8
+ title: 'Header',
9
+ menuGroups: [{
10
+ title: 'GROUP1',
11
+ id: 'group1',
12
+ links: [{
13
+ title: 'Winter Appeal 2024',
14
+ path: 'https://www.comicrelief.com/winterappeal/',
15
+ internal: {
16
+ type: 'ContentfulPageLandingPage'
17
+ }
18
+ }]
19
+ }, {
20
+ title: 'GROUP2',
21
+ id: 'group2',
22
+ links: [{
23
+ title: 'Red Nose Day',
24
+ path: 'https://www.comicrelief.com/rednoseday/schools',
25
+ internal: {
26
+ type: 'ContentfulPageLandingPage'
27
+ }
28
+ }, {
29
+ title: 'Billy Monger: The Race is On',
30
+ path: 'https://www.comicrelief.com/rednoseday/challenges/billy',
31
+ internal: {
32
+ type: 'ContentfulPageLandingPage'
33
+ }
34
+ }]
35
+ }, {
36
+ title: 'GROUP3',
37
+ id: 'group3',
38
+ links: [{
39
+ title: 'Funding',
40
+ path: 'https://www.comicrelief.com/what-your-money-does',
41
+ internal: {
42
+ type: 'ContentfulPageLandingPage'
43
+ }
44
+ }, {
45
+ title: 'Our Funding Practice',
46
+ path: 'https://www.comicrelief.com/our-legacy',
47
+ internal: {
48
+ type: 'ContentfulPageLandingPage'
49
+ }
50
+ }, {
51
+ title: 'Funding opportunities',
52
+ path: 'https://www.comicrelief.com/our-legacy-two',
53
+ internal: {
54
+ type: 'ContentfulPageLandingPage'
55
+ }
56
+ }, {
57
+ title: 'Our Funding strategy',
58
+ path: 'https://www.comicrelief.com/our-legacy-three',
59
+ internal: {
60
+ type: 'ContentfulPageLandingPage'
61
+ }
62
+ }, {
63
+ title: 'Managing your funding',
64
+ path: 'https://www.comicrelief.com/our-legacy-four',
65
+ internal: {
66
+ type: 'ContentfulPageLandingPage'
67
+ }
68
+ }]
69
+ }]
70
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@comicrelief/component-library",
3
3
  "author": "Comic Relief Engineering Team",
4
- "version": "8.13.0",
4
+ "version": "8.13.1",
5
5
  "main": "dist/index.js",
6
6
  "license": "ISC",
7
7
  "jest": {
@@ -476,6 +476,117 @@ const successCopy = (
476
476
  initialState = { isSuccess: false };
477
477
  const [success, setSuccess] = React.useState(false);
478
478
 
479
+ <>
480
+ <Header2025
481
+ characterLimit={50}
482
+ navItems={data}
483
+ rotate="true"
484
+ donateButton={
485
+ <>
486
+ <Link color="red" type="button" href="/donation">
487
+ Donate
488
+ </Link>
489
+ </>
490
+ }
491
+ metaIcons={
492
+ <>
493
+ <div>
494
+ <Icon
495
+ icon={esuIcon}
496
+ title="Newsletter"
497
+ target="_blank"
498
+ role="button"
499
+ href="#"
500
+ brand="comicrelief"
501
+ tabIndex="0"
502
+ isHeader
503
+ id="esu"
504
+ />
505
+ </div>
506
+ <div>
507
+ <Icon
508
+ icon={payinIcon}
509
+ title="Pay in"
510
+ target="_blank"
511
+ role="button"
512
+ href="https://donation.comicrelief.com/?cartId=rnd23-fundraisingpayin"
513
+ brand="comicrelief"
514
+ tabIndex="0"
515
+ isHeader
516
+ id="payin"
517
+ />
518
+ </div>
519
+
520
+ <div>
521
+ <Icon
522
+ icon={shopIcon}
523
+ title="Shop"
524
+ target="_blank"
525
+ role="button"
526
+ href="https://shop.comicrelief.com"
527
+ brand="comicrelief"
528
+ tabIndex="0"
529
+ isHeader
530
+ id="shop"
531
+ />
532
+ </div>
533
+
534
+ <div>
535
+ <Icon
536
+ icon={searchIcon}
537
+ title="Search"
538
+ target="self"
539
+ role="button"
540
+ href="/search"
541
+ brand="comicrelief"
542
+ tabIndex="0"
543
+ isHeader
544
+ id="search"
545
+ />
546
+ </div>
547
+ </>
548
+ }
549
+ />
550
+ <div style={{height: "1000px", backgroundColor: "turquoise", width:"100%"}}>
551
+ <img style={{width: "100%", maxWidth:"1440px", margin: "0 auto", display: "block"}} src="https://images.ctfassets.net/zsfivwzfgl3t/ecqrPx7BesE3JsYR2ns0E/a374276ba6d8024b9cd7c6d27c911303/Manchester_Marathon.jpeg"/>
552
+ </div>
553
+ </>;
554
+ ```
555
+
556
+ # -
557
+ # Comic Relief minimal header
558
+
559
+ ```js
560
+ import data from './data/data-live--minimal';
561
+ import Link from '../../Atoms/Link/Link';
562
+ import searchIcon from './assets/icon--search--2023.svg';
563
+ import shopIcon from './assets/icon--shop--2023.svg';
564
+ import payinIcon from './assets/PayIn.svg';
565
+ import esuIcon from './assets/Post.svg';
566
+
567
+ import Icon from '../../Atoms/SocialIcons/Icon/Icon';
568
+ import RichText from '../../Atoms/RichText/RichText';
569
+
570
+ const title = 'Stay in the know!';
571
+ const topCopy = (
572
+ <RichText
573
+ markup={`<p>Get regular email updates and info on what we're up to!</p>`}
574
+ />
575
+ );
576
+ const privacyCopy = (
577
+ <RichText
578
+ markup={`<p>Our <a class="link link--white inline" href="/privacy-notice">Privacy Policy</a> describes how we handle and protect your information.<br><br>If you are under 18, please make sure you have your parents’ permission before providing us with any personal details.</p>`}
579
+ />
580
+ );
581
+ const successCopy = (
582
+ <RichText
583
+ markup={`<p>Thanks! Your first email will be with you shortly</p>`}
584
+ />
585
+ );
586
+
587
+ initialState = { isSuccess: false };
588
+ const [success, setSuccess] = React.useState(false);
589
+
479
590
  <>
480
591
  <Header2025
481
592
  characterLimit={50}
@@ -82,7 +82,8 @@ const HeaderNav2025 = ({
82
82
  if (currentScreenWidth !== null && (isNotDesktop !== isCurrentlyNotDesktop)) {
83
83
  // If we've changed from desktop to not, remove any previously-attached MoreNav event
84
84
  // listeners, BEFORE we update the flag that'd remove the elements from the DOM:
85
- if (isCurrentlyNotDesktop) {
85
+ if (isCurrentlyNotDesktop && processedItems.moreNavGroups.length) {
86
+ // HERE CHERE
86
87
  document.getElementById('more-nav-ul').removeEventListener('mouseleave', resetMoreNavMouse);
87
88
  }
88
89
 
@@ -91,7 +92,7 @@ const HeaderNav2025 = ({
91
92
 
92
93
  // And since we've changed breakpoints, use these flags
93
94
  // to determine if we should render the More nav or not,
94
- setShowMoreNav(Boolean(!isCurrentlyNotDesktop && processedItems.moreNavGroups));
95
+ setShowMoreNav(Boolean(!isCurrentlyNotDesktop && processedItems.moreNavGroups.length));
95
96
  }
96
97
  }, [isNotDesktop, processedItems]);
97
98
 
@@ -150,7 +151,7 @@ const HeaderNav2025 = ({
150
151
  })}
151
152
 
152
153
  {/* Only actually render 'More' nav stuff when we've got content */}
153
- {showMoreNav && (
154
+ {showMoreNav ? (
154
155
  <MoreNav
155
156
  processedItems={processedItems}
156
157
  openedSubMenu={openedSubMenu}
@@ -159,7 +160,7 @@ const HeaderNav2025 = ({
159
160
  allowListed={allowListed}
160
161
  internalLinkHelper={InternalLinkHelper}
161
162
  />
162
- )}
163
+ ) : null}
163
164
 
164
165
  </NavMenu>
165
166
  )}
@@ -0,0 +1,79 @@
1
+ export default {
2
+ title: 'Header',
3
+ menuGroups: [
4
+ {
5
+ title: 'GROUP1',
6
+ id: 'group1',
7
+ links: [
8
+ {
9
+ title: 'Winter Appeal 2024',
10
+ path: 'https://www.comicrelief.com/winterappeal/',
11
+ internal: {
12
+ type: 'ContentfulPageLandingPage'
13
+ }
14
+ }
15
+ ]
16
+ },
17
+ {
18
+ title: 'GROUP2',
19
+ id: 'group2',
20
+ links: [
21
+ {
22
+ title: 'Red Nose Day',
23
+ path: 'https://www.comicrelief.com/rednoseday/schools',
24
+ internal: {
25
+ type: 'ContentfulPageLandingPage'
26
+ }
27
+ },
28
+ {
29
+ title: 'Billy Monger: The Race is On',
30
+ path: 'https://www.comicrelief.com/rednoseday/challenges/billy',
31
+ internal: {
32
+ type: 'ContentfulPageLandingPage'
33
+ }
34
+ }
35
+ ]
36
+ },
37
+ {
38
+ title: 'GROUP3',
39
+ id: 'group3',
40
+ links: [
41
+ {
42
+ title: 'Funding',
43
+ path: 'https://www.comicrelief.com/what-your-money-does',
44
+ internal: {
45
+ type: 'ContentfulPageLandingPage'
46
+ }
47
+ },
48
+ {
49
+ title: 'Our Funding Practice',
50
+ path: 'https://www.comicrelief.com/our-legacy',
51
+ internal: {
52
+ type: 'ContentfulPageLandingPage'
53
+ }
54
+ },
55
+ {
56
+ title: 'Funding opportunities',
57
+ path: 'https://www.comicrelief.com/our-legacy-two',
58
+ internal: {
59
+ type: 'ContentfulPageLandingPage'
60
+ }
61
+ },
62
+ {
63
+ title: 'Our Funding strategy',
64
+ path: 'https://www.comicrelief.com/our-legacy-three',
65
+ internal: {
66
+ type: 'ContentfulPageLandingPage'
67
+ }
68
+ },
69
+ {
70
+ title: 'Managing your funding',
71
+ path: 'https://www.comicrelief.com/our-legacy-four',
72
+ internal: {
73
+ type: 'ContentfulPageLandingPage'
74
+ }
75
+ }
76
+ ]
77
+ }
78
+ ]
79
+ };