@comicrelief/component-library 8.86.6 → 8.87.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.
package/dist/index.cjs.js
CHANGED
|
@@ -380,7 +380,7 @@ Valid keys: `+JSON.stringify(Object.keys(S),null," "));var De=Pe(oe,ke,ne,se,H+
|
|
|
380
380
|
// While Button heights now scale to fit content (important for lots
|
|
381
381
|
// of copy on a small breakpoint), we so still need to constrain the
|
|
382
382
|
// icon, to prevent silliness:
|
|
383
|
-
height:
|
|
383
|
+
height: 1.25rem;
|
|
384
384
|
}
|
|
385
385
|
|
|
386
386
|
${t&&g.css`
|
|
@@ -5214,7 +5214,7 @@ gap: ${T("md")};
|
|
|
5214
5214
|
opacity: 0.8;
|
|
5215
5215
|
font-size: 0.875rem;
|
|
5216
5216
|
margin-bottom: ${T("sm")};
|
|
5217
|
-
`,Q7=({navItems:e=[],...t})=>!e||e.length===0?null:f.jsx(uU,{"aria-label":"Primary footer navigation",role:"navigation",children:e.map(r=>{const n=Gi(Ji(r));return f.jsx(dU,{children:f.jsx(fU,{href:n,...t,children:f.jsx(hU,{children:r.title})})},`primary-${n}-${r.title}`)})});Q7.propTypes={navItems:l.arrayOf(l.shape({title:l.string.isRequired,path:l.string,url:l.string,reference:l.shape({path:l.string}),internal:l.shape({type:l.string})}))};const ev=({navItems:e=[],...t})=>!e||e.length===0?null:f.jsx(pU,{"aria-label":"Secondary footer navigation",role:"navigation",children:e.map(r=>{const n=Gi(Ji(r));return f.jsx(gU,{children:f.jsx(mU,{href:n,...t,children:f.jsx(vU,{children:r.title})})},`secondary-${n}-${r.title}`)})});ev.propTypes={navItems:l.arrayOf(l.shape({title:l.string.isRequired,path:l.string,url:l.string,reference:l.shape({path:l.string}),internal:l.shape({type:l.string})}))};const tv=({legalText:e,copyrightText:t,showFacebookSocialIcon:r,showInstagramSocialIcon:n,showXSocialIcon:o,showTikTokSocialIcon:s,showYouTubeSocialIcon:c,onNewsletterSubmit:u,primaryLinksList:p=[],secondaryLinksList:m=[],campaign:h="Comic Relief",additionalLegalLine:v="",showFundraisingRegulatorLogo:b=!1,showEmailSignup:C=!0,animateRotate:x=!0
|
|
5217
|
+
`,Q7=({navItems:e=[],...t})=>!e||e.length===0?null:f.jsx(uU,{"aria-label":"Primary footer navigation",role:"navigation",children:e.map(r=>{const n=Gi(Ji(r));return f.jsx(dU,{children:f.jsx(fU,{href:n,...t,children:f.jsx(hU,{children:r.title})})},`primary-${n}-${r.title}`)})});Q7.propTypes={navItems:l.arrayOf(l.shape({title:l.string.isRequired,path:l.string,url:l.string,reference:l.shape({path:l.string}),internal:l.shape({type:l.string})}))};const ev=({navItems:e=[],...t})=>!e||e.length===0?null:f.jsx(pU,{"aria-label":"Secondary footer navigation",role:"navigation",children:e.map(r=>{const n=Gi(Ji(r));return f.jsx(gU,{children:f.jsx(mU,{href:n,...t,children:f.jsx(vU,{children:r.title})})},`secondary-${n}-${r.title}`)})});ev.propTypes={navItems:l.arrayOf(l.shape({title:l.string.isRequired,path:l.string,url:l.string,reference:l.shape({path:l.string}),internal:l.shape({type:l.string})}))};const tv=({legalText:e,copyrightText:t,showFacebookSocialIcon:r,showInstagramSocialIcon:n,showXSocialIcon:o,showTikTokSocialIcon:s,showYouTubeSocialIcon:c,onNewsletterSubmit:u,primaryLinksList:p=[],secondaryLinksList:m=[],campaign:h="Comic Relief",additionalLegalLine:v="",showFundraisingRegulatorLogo:b=!1,showEmailSignup:C=!0,animateRotate:x=!0,externalCRLink:$=null,...w})=>{const M=h.replace(/\s/g,"").toLowerCase(),O=typeof t=="string"?t.trim():"",A=yc({email:_r().nullable().transform(W=>W===""?null:W).email("Please provide a valid email address")}),F=qW({mode:"onBlur",resolver:ZW(A)}),{handleSubmit:D}=F,ee=W=>{u&&u(W.email)};return f.jsx("div",{children:f.jsx(iU,{...w,children:f.jsxs(oU,{children:[v&&f.jsx(aU,{children:v}),f.jsx(Sl,{$mobileOnly:!0,children:f.jsx(ud,{href:$??"/",title:`Go to ${h} homepage`,$animateRotate:x,target:$?"blank":"self",children:f.jsx(Wn,{sizeSm:"59px",sizeMd:"59px",sizeLg:"72px",rotate:!1,campaign:h})})}),f.jsxs(sU,{$hasEmailSignup:C,children:[f.jsxs(lU,{children:[C&&f.jsx(cU,{children:f.jsx(TW,{...F,children:f.jsx("form",{onSubmit:D(ee),noValidate:!0,children:f.jsx(J7,{formContext:F})})})}),f.jsx(i5,{$desktopOnly:!0,$inTopSection:!0,children:f.jsx(Ms,{campaign:M,newStyle:!0,invertColor:!0,showFacebookSocialIcon:r,showInstagramSocialIcon:n,showXSocialIcon:o,showTikTokSocialIcon:s,showYouTubeSocialIcon:c})})]}),f.jsx(Sl,{$desktopOnly:!0,$showCRLogoOnly:!0,children:f.jsx(ud,{href:$??"/",title:`Go to ${h} homepage`,$animateRotate:x,target:$?"blank":"self",children:f.jsx(Wn,{sizeSm:"59px",sizeMd:"59px",sizeLg:"59px",rotate:!1,campaign:h})})}),f.jsxs(Sl,{$desktopOnly:!0,$showPairedLogos:!0,children:[f.jsx(ud,{href:$??"/",title:`Go to ${h} homepage`,$animateRotate:x,target:$?"blank":"self",children:f.jsx(Wn,{sizeSm:"59px",sizeMd:"59px",sizeLg:"59px",rotate:!1,campaign:h})}),b&&f.jsx(M2,{animateOnHover:!0,noMargin:!0})]})]}),f.jsx(Q7,{navItems:p,...w}),f.jsx(i5,{$mobileOnly:!0,children:f.jsx(Ms,{campaign:M,newStyle:!0,invertColor:!0,showFacebookSocialIcon:r,showInstagramSocialIcon:n,showXSocialIcon:o,showTikTokSocialIcon:s,showYouTubeSocialIcon:c})}),f.jsx(ev,{navItems:m,...w}),f.jsxs(yU,{"data-testid":"footer-copyright",children:[O.length>0&&f.jsx(o5,{children:O}),e&&f.jsx(o5,{children:e})]}),f.jsx(Sl,{$mobileOnly:!0,$showFundraiserAtBottom:!0,children:b&&f.jsx(M2,{noMargin:!0})})]})})})};tv.propTypes={primaryLinksList:l.arrayOf(l.shape({title:l.string,path:l.string,url:l.string,reference:l.shape({path:l.string}),internal:l.shape({type:l.string})})),secondaryLinksList:l.arrayOf(l.shape({title:l.string,path:l.string,url:l.string,reference:l.shape({path:l.string}),internal:l.shape({type:l.string})})),legalText:l.string,copyrightText:l.string,campaign:l.string,additionalLegalLine:l.string,showFundraisingRegulatorLogo:l.bool,showEmailSignup:l.bool,showFacebookSocialIcon:l.bool,showInstagramSocialIcon:l.bool,showXSocialIcon:l.bool,showTikTokSocialIcon:l.bool,showYouTubeSocialIcon:l.bool,animateRotate:l.bool,onNewsletterSubmit:l.func,externalCRLink:l.string};const bU=g(fe)`
|
|
5218
5218
|
${sn};
|
|
5219
5219
|
`,I1=g.span`
|
|
5220
5220
|
background-color: ${({theme:e})=>e.color("deep_violet_dark")};
|
package/dist/index.es.js
CHANGED
|
@@ -1859,7 +1859,7 @@ const jn = {
|
|
|
1859
1859
|
// While Button heights now scale to fit content (important for lots
|
|
1860
1860
|
// of copy on a small breakpoint), we so still need to constrain the
|
|
1861
1861
|
// icon, to prevent silliness:
|
|
1862
|
-
height:
|
|
1862
|
+
height: 1.25rem;
|
|
1863
1863
|
}
|
|
1864
1864
|
|
|
1865
1865
|
${t && X`
|
|
@@ -28381,26 +28381,36 @@ const xq = ({
|
|
|
28381
28381
|
showFundraisingRegulatorLogo: y = !1,
|
|
28382
28382
|
showEmailSignup: C = !0,
|
|
28383
28383
|
animateRotate: w = !0,
|
|
28384
|
-
|
|
28384
|
+
externalCRLink: $ = null,
|
|
28385
|
+
...x
|
|
28385
28386
|
}) => {
|
|
28386
|
-
const
|
|
28387
|
-
email: Tr().nullable().transform((
|
|
28388
|
-
}),
|
|
28387
|
+
const M = f.replace(/\s/g, "").toLowerCase(), T = typeof t == "string" ? t.trim() : "", A = $c({
|
|
28388
|
+
email: Tr().nullable().transform((U) => U === "" ? null : U).email("Please provide a valid email address")
|
|
28389
|
+
}), I = GU({
|
|
28389
28390
|
mode: "onBlur",
|
|
28390
|
-
resolver: XU(
|
|
28391
|
-
}), { handleSubmit:
|
|
28392
|
-
u && u(
|
|
28391
|
+
resolver: XU(A)
|
|
28392
|
+
}), { handleSubmit: D } = I, te = (U) => {
|
|
28393
|
+
u && u(U.email);
|
|
28393
28394
|
};
|
|
28394
|
-
return /* @__PURE__ */ g("div", { children: /* @__PURE__ */ g(aq, {
|
|
28395
|
+
return /* @__PURE__ */ g("div", { children: /* @__PURE__ */ g(aq, { ...x, children: /* @__PURE__ */ z(sq, { children: [
|
|
28395
28396
|
m && /* @__PURE__ */ g(lq, { children: m }),
|
|
28396
|
-
/* @__PURE__ */ g(Sl, { $mobileOnly: !0, children: /* @__PURE__ */ g(
|
|
28397
|
+
/* @__PURE__ */ g(Sl, { $mobileOnly: !0, children: /* @__PURE__ */ g(
|
|
28398
|
+
gd,
|
|
28399
|
+
{
|
|
28400
|
+
href: $ ?? "/",
|
|
28401
|
+
title: `Go to ${f} homepage`,
|
|
28402
|
+
$animateRotate: w,
|
|
28403
|
+
target: $ ? "blank" : "self",
|
|
28404
|
+
children: /* @__PURE__ */ g(wi, { sizeSm: "59px", sizeMd: "59px", sizeLg: "72px", rotate: !1, campaign: f })
|
|
28405
|
+
}
|
|
28406
|
+
) }),
|
|
28397
28407
|
/* @__PURE__ */ z(cq, { $hasEmailSignup: C, children: [
|
|
28398
28408
|
/* @__PURE__ */ z(uq, { children: [
|
|
28399
|
-
C && /* @__PURE__ */ g(dq, { children: /* @__PURE__ */ g(AU, { ...
|
|
28409
|
+
C && /* @__PURE__ */ g(dq, { children: /* @__PURE__ */ g(AU, { ...I, children: /* @__PURE__ */ g("form", { onSubmit: D(te), noValidate: !0, children: /* @__PURE__ */ g(C7, { formContext: I }) }) }) }),
|
|
28400
28410
|
/* @__PURE__ */ g(l5, { $desktopOnly: !0, $inTopSection: !0, children: /* @__PURE__ */ g(
|
|
28401
28411
|
h2,
|
|
28402
28412
|
{
|
|
28403
|
-
campaign:
|
|
28413
|
+
campaign: M,
|
|
28404
28414
|
newStyle: !0,
|
|
28405
28415
|
invertColor: !0,
|
|
28406
28416
|
showFacebookSocialIcon: r,
|
|
@@ -28411,17 +28421,35 @@ const xq = ({
|
|
|
28411
28421
|
}
|
|
28412
28422
|
) })
|
|
28413
28423
|
] }),
|
|
28414
|
-
/* @__PURE__ */ g(Sl, { $desktopOnly: !0, $showCRLogoOnly: !0, children: /* @__PURE__ */ g(
|
|
28424
|
+
/* @__PURE__ */ g(Sl, { $desktopOnly: !0, $showCRLogoOnly: !0, children: /* @__PURE__ */ g(
|
|
28425
|
+
gd,
|
|
28426
|
+
{
|
|
28427
|
+
href: $ ?? "/",
|
|
28428
|
+
title: `Go to ${f} homepage`,
|
|
28429
|
+
$animateRotate: w,
|
|
28430
|
+
target: $ ? "blank" : "self",
|
|
28431
|
+
children: /* @__PURE__ */ g(wi, { sizeSm: "59px", sizeMd: "59px", sizeLg: "59px", rotate: !1, campaign: f })
|
|
28432
|
+
}
|
|
28433
|
+
) }),
|
|
28415
28434
|
/* @__PURE__ */ z(Sl, { $desktopOnly: !0, $showPairedLogos: !0, children: [
|
|
28416
|
-
/* @__PURE__ */ g(
|
|
28435
|
+
/* @__PURE__ */ g(
|
|
28436
|
+
gd,
|
|
28437
|
+
{
|
|
28438
|
+
href: $ ?? "/",
|
|
28439
|
+
title: `Go to ${f} homepage`,
|
|
28440
|
+
$animateRotate: w,
|
|
28441
|
+
target: $ ? "blank" : "self",
|
|
28442
|
+
children: /* @__PURE__ */ g(wi, { sizeSm: "59px", sizeMd: "59px", sizeLg: "59px", rotate: !1, campaign: f })
|
|
28443
|
+
}
|
|
28444
|
+
),
|
|
28417
28445
|
y && /* @__PURE__ */ g(R2, { animateOnHover: !0, noMargin: !0 })
|
|
28418
28446
|
] })
|
|
28419
28447
|
] }),
|
|
28420
|
-
/* @__PURE__ */ g($7, { navItems: h,
|
|
28448
|
+
/* @__PURE__ */ g($7, { navItems: h, ...x }),
|
|
28421
28449
|
/* @__PURE__ */ g(l5, { $mobileOnly: !0, children: /* @__PURE__ */ g(
|
|
28422
28450
|
h2,
|
|
28423
28451
|
{
|
|
28424
|
-
campaign:
|
|
28452
|
+
campaign: M,
|
|
28425
28453
|
newStyle: !0,
|
|
28426
28454
|
invertColor: !0,
|
|
28427
28455
|
showFacebookSocialIcon: r,
|
|
@@ -28431,9 +28459,9 @@ const xq = ({
|
|
|
28431
28459
|
showYouTubeSocialIcon: c
|
|
28432
28460
|
}
|
|
28433
28461
|
) }),
|
|
28434
|
-
/* @__PURE__ */ g(_7, { navItems: p,
|
|
28462
|
+
/* @__PURE__ */ g(_7, { navItems: p, ...x }),
|
|
28435
28463
|
/* @__PURE__ */ z(wq, { "data-testid": "footer-copyright", children: [
|
|
28436
|
-
|
|
28464
|
+
T.length > 0 && /* @__PURE__ */ g(c5, { children: T }),
|
|
28437
28465
|
e && /* @__PURE__ */ g(c5, { children: e })
|
|
28438
28466
|
] }),
|
|
28439
28467
|
/* @__PURE__ */ g(Sl, { $mobileOnly: !0, $showFundraiserAtBottom: !0, children: y && /* @__PURE__ */ g(R2, { noMargin: !0 }) })
|
|
@@ -28482,7 +28510,10 @@ xq.propTypes = {
|
|
|
28482
28510
|
/** Animate logo rotation on hover */
|
|
28483
28511
|
animateRotate: l.bool,
|
|
28484
28512
|
/** Optional function to handle newsletter signup form submission */
|
|
28485
|
-
onNewsletterSubmit: l.func
|
|
28513
|
+
onNewsletterSubmit: l.func,
|
|
28514
|
+
// Rather than just using a boolean here, this will allow us to point
|
|
28515
|
+
// the CR logo at any Sorry/Lite version of CRcom, if needs arise:
|
|
28516
|
+
externalCRLink: l.string
|
|
28486
28517
|
};
|
|
28487
28518
|
const Cq = b(he)`
|
|
28488
28519
|
${Fn};
|
package/package.json
CHANGED
|
@@ -72,7 +72,7 @@ const StyledButton = styled.button`
|
|
|
72
72
|
// While Button heights now scale to fit content (important for lots
|
|
73
73
|
// of copy on a small breakpoint), we so still need to constrain the
|
|
74
74
|
// icon, to prevent silliness:
|
|
75
|
-
height:
|
|
75
|
+
height: 1.25rem;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
${($iconLeft && css`
|
|
@@ -40,6 +40,7 @@ const FooterNew = ({
|
|
|
40
40
|
showFundraisingRegulatorLogo = false,
|
|
41
41
|
showEmailSignup = true,
|
|
42
42
|
animateRotate = true,
|
|
43
|
+
externalCRLink = null,
|
|
43
44
|
...rest
|
|
44
45
|
}) => {
|
|
45
46
|
// Remove white space between words
|
|
@@ -79,7 +80,12 @@ const FooterNew = ({
|
|
|
79
80
|
)}
|
|
80
81
|
|
|
81
82
|
<LogosContainer $mobileOnly>
|
|
82
|
-
<Brand
|
|
83
|
+
<Brand
|
|
84
|
+
href={externalCRLink ?? '/'}
|
|
85
|
+
title={`Go to ${campaign} homepage`}
|
|
86
|
+
$animateRotate={animateRotate}
|
|
87
|
+
target={externalCRLink ? 'blank' : 'self'}
|
|
88
|
+
>
|
|
83
89
|
<Logo sizeSm="59px" sizeMd="59px" sizeLg="72px" rotate={false} campaign={campaign} />
|
|
84
90
|
</Brand>
|
|
85
91
|
</LogosContainer>
|
|
@@ -109,12 +115,22 @@ const FooterNew = ({
|
|
|
109
115
|
</SocialIconWrapper>
|
|
110
116
|
</TopSectionLeft>
|
|
111
117
|
<LogosContainer $desktopOnly $showCRLogoOnly>
|
|
112
|
-
<Brand
|
|
118
|
+
<Brand
|
|
119
|
+
href={externalCRLink ?? '/'}
|
|
120
|
+
title={`Go to ${campaign} homepage`}
|
|
121
|
+
$animateRotate={animateRotate}
|
|
122
|
+
target={externalCRLink ? 'blank' : 'self'}
|
|
123
|
+
>
|
|
113
124
|
<Logo sizeSm="59px" sizeMd="59px" sizeLg="59px" rotate={false} campaign={campaign} />
|
|
114
125
|
</Brand>
|
|
115
126
|
</LogosContainer>
|
|
116
127
|
<LogosContainer $desktopOnly $showPairedLogos>
|
|
117
|
-
<Brand
|
|
128
|
+
<Brand
|
|
129
|
+
href={externalCRLink ?? '/'}
|
|
130
|
+
title={`Go to ${campaign} homepage`}
|
|
131
|
+
$animateRotate={animateRotate}
|
|
132
|
+
target={externalCRLink ? 'blank' : 'self'}
|
|
133
|
+
>
|
|
118
134
|
<Logo sizeSm="59px" sizeMd="59px" sizeLg="59px" rotate={false} campaign={campaign} />
|
|
119
135
|
</Brand>
|
|
120
136
|
{showFundraisingRegulatorLogo && <FundraisingRegulatorLogo animateOnHover noMargin />}
|
|
@@ -203,7 +219,10 @@ FooterNew.propTypes = {
|
|
|
203
219
|
/** Animate logo rotation on hover */
|
|
204
220
|
animateRotate: PropTypes.bool,
|
|
205
221
|
/** Optional function to handle newsletter signup form submission */
|
|
206
|
-
onNewsletterSubmit: PropTypes.func
|
|
222
|
+
onNewsletterSubmit: PropTypes.func,
|
|
223
|
+
// Rather than just using a boolean here, this will allow us to point
|
|
224
|
+
// the CR logo at any Sorry/Lite version of CRcom, if needs arise:
|
|
225
|
+
externalCRLink: PropTypes.string
|
|
207
226
|
};
|
|
208
227
|
|
|
209
228
|
export default FooterNew;
|
|
@@ -21,7 +21,7 @@ export default function FooterNewExample() {
|
|
|
21
21
|
showTikTokSocialIcon
|
|
22
22
|
showYouTubeSocialIcon
|
|
23
23
|
animateRotate
|
|
24
|
-
onNewsletterSubmit={
|
|
24
|
+
onNewsletterSubmit={email => console.log('Newsletter submitted. Normally at this point, the frontend would run its own function to send.', email)}
|
|
25
25
|
/>
|
|
26
26
|
|
|
27
27
|
<h3>FooterNew without email signup</h3>
|
|
@@ -40,6 +40,23 @@ export default function FooterNewExample() {
|
|
|
40
40
|
animateRotate
|
|
41
41
|
/>
|
|
42
42
|
|
|
43
|
+
<h3>FooterNew without email signup + external CR logo link (as per Donate)</h3>
|
|
44
|
+
<FooterNew
|
|
45
|
+
primaryLinksList={primaryLinksList}
|
|
46
|
+
secondaryLinksList={secondaryLinksList}
|
|
47
|
+
legalText={footerCopy.copy}
|
|
48
|
+
campaign="Comic Relief"
|
|
49
|
+
showEmailSignup={false}
|
|
50
|
+
showFundraisingRegulatorLogo
|
|
51
|
+
showFacebookSocialIcon
|
|
52
|
+
showInstagramSocialIcon
|
|
53
|
+
showXSocialIcon
|
|
54
|
+
showTikTokSocialIcon
|
|
55
|
+
showYouTubeSocialIcon
|
|
56
|
+
animateRotate
|
|
57
|
+
externalCRLink="https://www.comicrelief.com"
|
|
58
|
+
/>
|
|
59
|
+
|
|
43
60
|
</div>
|
|
44
61
|
);
|
|
45
62
|
}
|