@comicrelief/component-library 6.9.1 → 7.0.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.
- package/cypress/integration/components/Organisms/EmailSignUp.spec.js +47 -132
- package/dist/components/Molecules/Box/Box.js +6 -6
- package/dist/components/Molecules/Card/Card.js +5 -5
- package/dist/components/Organisms/EmailSignUp/EmailSignUp.md +8 -123
- package/dist/components/Organisms/EmailSignUp/EmailSignUp.style.js +46 -29
- package/dist/components/Organisms/EmailSignUp/EmailSignUp.test.js +24 -69
- package/dist/components/Organisms/EmailSignUp/EmailSignUpForm.js +92 -0
- package/dist/components/Organisms/EmailSignUp/_Confetti.js +116 -0
- package/dist/components/Organisms/EmailSignUp/_EmailSignUp.js +107 -0
- package/dist/components/Organisms/EmailSignUp/_EmailSignUpConfig.js +51 -0
- package/dist/components/Organisms/EmailSignUp/_TextInput.js +51 -0
- package/dist/components/Organisms/EmailSignUp/__snapshots__/EmailSignUp.test.js.snap +249 -406
- package/dist/components/Organisms/Header/Header.md +1 -13
- package/dist/components/Organisms/Membership/Membership.test.js +1 -1
- package/dist/index.js +14 -10
- package/package.json +2 -1
- package/src/components/Molecules/Box/Box.js +6 -6
- package/src/components/Molecules/Card/Card.js +5 -5
- package/src/components/Organisms/EmailSignUp/EmailSignUp.md +8 -123
- package/src/components/Organisms/EmailSignUp/EmailSignUp.style.js +33 -13
- package/src/components/Organisms/EmailSignUp/EmailSignUp.test.js +35 -69
- package/src/components/Organisms/EmailSignUp/EmailSignUpForm.js +60 -0
- package/src/components/Organisms/EmailSignUp/_Confetti.js +106 -0
- package/src/components/Organisms/EmailSignUp/_EmailSignUp.js +138 -0
- package/src/components/Organisms/EmailSignUp/_EmailSignUpConfig.js +54 -0
- package/src/components/Organisms/EmailSignUp/_TextInput.js +45 -0
- package/src/components/Organisms/EmailSignUp/__snapshots__/EmailSignUp.test.js.snap +249 -406
- package/src/components/Organisms/Header/Header.md +1 -13
- package/src/components/Organisms/Membership/Membership.test.js +33 -33
- package/src/index.js +10 -4
- package/cypress/integration/components/Molecules/HeaderEsuWithIcon.spec.js +0 -69
- package/dist/components/Molecules/HeaderEsuWithIcon/HeaderEsuWithIcon.js +0 -136
- package/dist/components/Molecules/HeaderEsuWithIcon/HeaderEsuWithIcon.md +0 -47
- package/dist/components/Molecules/HeaderEsuWithIcon/HeaderEsuWithIcon.style.js +0 -52
- package/dist/components/Molecules/HeaderEsuWithIcon/HeaderEsuWithIcon.test.js +0 -99
- package/dist/components/Molecules/HeaderEsuWithIcon/__snapshots__/HeaderEsuWithIcon.test.js.snap +0 -1211
- package/dist/components/Molecules/HeaderEsuWithIcon/assets/HeaderIcons.js +0 -25
- package/dist/components/Molecules/HeaderEsuWithIcon/assets/icon--close.svg +0 -5
- package/dist/components/Molecules/HeaderEsuWithIcon/assets/icon--email.svg +0 -5
- package/dist/components/Organisms/EmailSignUp/EmailSignUp.js +0 -182
- package/src/components/Molecules/HeaderEsuWithIcon/HeaderEsuWithIcon.js +0 -135
- package/src/components/Molecules/HeaderEsuWithIcon/HeaderEsuWithIcon.md +0 -47
- package/src/components/Molecules/HeaderEsuWithIcon/HeaderEsuWithIcon.style.js +0 -60
- package/src/components/Molecules/HeaderEsuWithIcon/HeaderEsuWithIcon.test.js +0 -103
- package/src/components/Molecules/HeaderEsuWithIcon/__snapshots__/HeaderEsuWithIcon.test.js.snap +0 -1211
- package/src/components/Molecules/HeaderEsuWithIcon/assets/HeaderIcons.js +0 -15
- package/src/components/Molecules/HeaderEsuWithIcon/assets/icon--close.svg +0 -5
- package/src/components/Molecules/HeaderEsuWithIcon/assets/icon--email.svg +0 -5
- package/src/components/Organisms/EmailSignUp/EmailSignUp.js +0 -197
|
@@ -36,12 +36,11 @@ import Link from '../../Atoms/Link/Link';
|
|
|
36
36
|
/>;
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
# Comic Relief header with Search
|
|
39
|
+
# Comic Relief header with Search
|
|
40
40
|
|
|
41
41
|
```js
|
|
42
42
|
import data from './data/data';
|
|
43
43
|
import Link from '../../Atoms/Link/Link';
|
|
44
|
-
import HeaderEsuWithIcon from '../../Molecules/HeaderEsuWithIcon/HeaderEsuWithIcon';
|
|
45
44
|
import searchIcon from './assets/icon--search.svg';
|
|
46
45
|
import Icon from '../../Atoms/SocialIcons/Icon/Icon';
|
|
47
46
|
import RichText from '../../Atoms/RichText/RichText';
|
|
@@ -86,17 +85,6 @@ const [success, setSuccess] = React.useState(false);
|
|
|
86
85
|
tabIndex="0"
|
|
87
86
|
/>
|
|
88
87
|
</div>
|
|
89
|
-
|
|
90
|
-
<HeaderEsuWithIcon
|
|
91
|
-
title={title}
|
|
92
|
-
topCopy={topCopy}
|
|
93
|
-
privacyCopy={privacyCopy}
|
|
94
|
-
successCopy={successCopy}
|
|
95
|
-
isSuccess={success}
|
|
96
|
-
privacyCopy={privacyCopy}
|
|
97
|
-
errorMsg=""
|
|
98
|
-
subscribe={() => setSuccess(!success)}
|
|
99
|
-
/>
|
|
100
88
|
</>
|
|
101
89
|
}
|
|
102
90
|
/>;
|
|
@@ -29,5 +29,5 @@ it("renders correctly", function () {
|
|
|
29
29
|
subtitle: "Jordan was close to suicide - which is now the biggest killer of men under 45 in the UK. Join now and help save lives.",
|
|
30
30
|
otherDescription: "Your donation will help us fund amazing projects in the UK and around the world."
|
|
31
31
|
})).toJSON();
|
|
32
|
-
expect(tree).toMatchInlineSnapshot("\n .c6 {\n font-size: 1.5rem;\n line-height: 1.5rem;\n text-transform: inherit;\n font-weight: 800;\n font-family: 'Montserrat',Helvetica,Arial,sans-serif;\n }\n\n .c7 {\n font-size: 1rem;\n line-height: 1rem;\n text-transform: inherit;\n line-height: normal;\n font-family: 'Montserrat',Helvetica,Arial,sans-serif;\n }\n\n .c12 {\n font-size: 1rem;\n line-height: 1rem;\n text-transform: inherit;\n font-family: 'Montserrat',Helvetica,Arial,sans-serif;\n }\n\n .c16 {\n font-size: 1rem;\n line-height: 1rem;\n text-transform: inherit;\n font-weight: bold;\n line-height: normal;\n font-family: 'Montserrat',Helvetica,Arial,sans-serif;\n }\n\n .c22 {\n font-size: 1rem;\n line-height: 1rem;\n text-transform: inherit;\n font-weight: 500;\n line-height: normal;\n font-family: 'Montserrat',Helvetica,Arial,sans-serif;\n }\n\n .c1 {\n display: block;\n width: 100%;\n height: 100%;\n position: relative;\n }\n\n .c3 {\n width: 100%;\n height: 100%;\n display: block;\n object-fit: cover;\n }\n\n .c14 {\n position: relative;\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-flex-direction: column;\n -ms-flex-direction: column;\n flex-direction: column;\n color: #5C5C5E;\n width: 100%;\n }\n\n .c17 {\n margin-bottom: 0.5rem;\n }\n\n .c19 {\n position: relative;\n box-sizing: border-box;\n width: 100%;\n height: 48px;\n padding: 1rem 1.5rem;\n background-color: #F4F3F5;\n border: 1px solid;\n border-color: #E1E2E3;\n box-shadow: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n color: #000000;\n border-radius: 0.5rem;\n font-size: inherit;\n z-index: 2;\n font-family: 'Montserrat',Helvetica,Arial,sans-serif;\n }\n\n .c19:focus {\n border: 1px solid #666;\n }\n\n .c18 {\n position: relative;\n font-size: 1.25rem;\n }\n\n .c0 {\n background-color: #FEE3CC;\n position: relative;\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -webkit-justify-content: center;\n -ms-flex-pack: center;\n justify-content: center;\n min-height: 100vh;\n }\n\n .c2 {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n height: auto;\n }\n\n .c2:before {\n color: #FEE3CC;\n content: '';\n position: absolute;\n width: 100%;\n height: 100%;\n box-shadow: inset 0px 4rem 2rem -2rem;\n }\n\n .c4 {\n position: relative;\n max-width: 320px;\n text-align: center;\n margin-bottom: 50%;\n }\n\n .c5 {\n padding: 2rem 1rem 0;\n margin-bottom: 2rem;\n }\n\n .c8 {\n background-color: #FFFFFF;\n box-shadow: 0px 1rem 4rem rgba(0,0,0,0.3);\n height: 450px;\n }\n\n .c9 {\n padding: 1rem;\n }\n\n .c9 h3 {\n margin-top: 1rem;\n }\n\n .c9 input {\n max-width: 100%;\n margin: 0;\n }\n\n .c10 {\n padding: 0;\n margin: 0;\n border: none;\n }\n\n .c10 >:not(:last-child):not(legend) {\n margin-bottom: 2rem;\n }\n\n .c11 {\n margin: 0;\n padding: 0;\n }\n\n .c13 {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: justify;\n -webkit-justify-content: space-between;\n -ms-flex-pack: justify;\n justify-content: space-between;\n }\n\n .c13 label {\n -webkit-flex: 0 0 30%;\n -ms-flex: 0 0 30%;\n flex: 0 0 30%;\n }\n\n .c13 label input {\n cursor: pointer;\n padding: 1rem;\n }\n\n .c13 label:hover input {\n border-color: #E52630;\n }\n\n .c21 {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-align-items: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n }\n\n .c23 {\n margin-right: auto;\n }\n\n .c24 {\n position: relative;\n -webkit-flex: 0 0 50%;\n -ms-flex: 0 0 50%;\n flex: 0 0 50%;\n font-weight: 400;\n display: block;\n }\n\n .c24 span {\n position: absolute;\n padding: 0px 15px;\n font-size: 20px;\n top: 50%;\n -webkit-transform: translateY(-50%);\n -ms-transform: translateY(-50%);\n transform: translateY(-50%);\n left: 0px;\n font-weight: 500;\n }\n\n .c24 input {\n border: 2px solid #E1E2E3;\n background: transparent;\n padding: 0.5rem 1rem 0.5rem 2rem;\n }\n\n .c24 input:focus {\n border: 2px solid #E52630;\n }\n\n .c26 {\n line-height: 1.5;\n }\n\n .c25 {\n width: 100%;\n color: #FFFFFF;\n font-size: 1rem;\n font-weight: bold;\n cursor: pointer;\n padding: 1rem 0.5rem;\n background: #E52630;\n border: none;\n border-radius: 100px;\n }\n\n .c25:active,\n .c25:focus,\n .c25:hover {\n background-color: #961D35;\n }\n\n .c15 {\n display: block;\n }\n\n .c15 input {\n border: 2px solid #E1E2E3;\n font-size: 1.5rem;\n font-weight: 800;\n -webkit-letter-spacing: -2px;\n -moz-letter-spacing: -2px;\n -ms-letter-spacing: -2px;\n letter-spacing: -2px;\n height: auto;\n }\n\n .c20 {\n display: block;\n }\n\n .c20 input {\n border: 2px solid #E1E2E3;\n font-size: 1.5rem;\n font-weight: 800;\n -webkit-letter-spacing: -2px;\n -moz-letter-spacing: -2px;\n -ms-letter-spacing: -2px;\n letter-spacing: -2px;\n height: auto;\n border-color: #E52630;\n background-color: #E52630;\n color: #FFFFFF;\n }\n\n @media (min-width:740px) {\n .c19 {\n max-width: 290px;\n }\n }\n\n @media (min-width:1024px) {\n .c0 {\n -webkit-align-items: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: inherit;\n -webkit-justify-content: inherit;\n -ms-flex-pack: inherit;\n justify-content: inherit;\n min-height: 750px;\n height: 100vh;\n max-height: 900px;\n -webkit-flex-direction: row;\n -ms-flex-direction: row;\n flex-direction: row;\n }\n }\n\n @media (min-width:1024px) {\n .c2 {\n height: 100%;\n }\n\n .c2:before {\n content: none;\n }\n }\n\n @media (min-width:1024px) {\n .c4 {\n margin: 0 8rem;\n max-width: 420px;\n }\n }\n\n @media (min-width:1024px) {\n .c8 {\n height: 430px;\n }\n }\n\n @media (min-width:1024px) {\n .c24 {\n -webkit-flex: 0 0 60%;\n -ms-flex: 0 0 60%;\n flex: 0 0 60%;\n }\n }\n\n @media (min-width:1024px) {\n .c25 {\n width: auto;\n padding: 1rem 2rem;\n margin: 0 auto 2rem;\n }\n }\n\n <div\n className=\"c0\"\n id=\"mship-1\"\n >\n <div\n className=\"c1 c2\"\n height=\"100%\"\n width=\"100%\"\n >\n <img\n alt=\"Background image\"\n className=\"c3 lazyload\"\n data-src={null}\n height=\"100%\"\n width=\"100%\"\n />\n </div>\n <div\n className=\"c4\"\n >\n <div\n className=\"c5\"\n >\n <h2\n className=\"c6\"\n color=\"inherit\"\n size=\"l\"\n >\n Help someone like Jordan see a better tomorrow\n </h2>\n <p\n className=\"c7\"\n color=\"inherit\"\n size=\"s\"\n >\n Jordan was close to suicide - which is now the biggest killer of men under 45 in the UK. Join now and help save lives.\n </p>\n </div>\n <div\n className=\"c8\"\n >\n <form\n className=\"c9\"\n onSubmit={[Function]}\n >\n <fieldset\n className=\"c10\"\n >\n <legend\n className=\"c11\"\n >\n <h3\n className=\"c12\"\n color=\"inherit\"\n size=\"s\"\n >\n Choose your monthly donation\n </h3>\n </legend>\n <div\n className=\"c13\"\n >\n <label\n className=\"c14 c15\"\n htmlFor=\"mship-1--moneyBuy-box1\"\n >\n <span\n className=\"c16 c17\"\n color=\"inherit\"\n dangerouslySetInnerHTML={\n Object {\n \"__html\": \"\",\n }\n }\n size=\"s\"\n />\n <div\n className=\"c18\"\n >\n \n <input\n aria-describedby=\"mship-1--moneyBuy-box1\"\n aria-label=\"\xA35\"\n className=\"c19\"\n id=\"mship-1--moneyBuy-box1\"\n name=\"mship-1--moneyBuy1\"\n onClick={[Function]}\n placeholder=\"\"\n required={false}\n type=\"button\"\n value=\"\xA3 5\"\n />\n </div>\n \n </label>\n <label\n className=\"c14 c20\"\n htmlFor=\"mship-1--moneyBuy-box2\"\n >\n <span\n className=\"c16 c17\"\n color=\"inherit\"\n dangerouslySetInnerHTML={\n Object {\n \"__html\": \"\",\n }\n }\n size=\"s\"\n />\n <div\n className=\"c18\"\n >\n \n <input\n aria-describedby=\"mship-1--moneyBuy-box2\"\n aria-label=\"\xA310\"\n className=\"c19\"\n id=\"mship-1--moneyBuy-box2\"\n name=\"mship-1--moneyBuy2\"\n onClick={[Function]}\n placeholder=\"\"\n required={false}\n type=\"button\"\n value=\"\xA3 10\"\n />\n </div>\n \n </label>\n <label\n className=\"c14 c15\"\n htmlFor=\"mship-1--moneyBuy-box3\"\n >\n <span\n className=\"c16 c17\"\n color=\"inherit\"\n dangerouslySetInnerHTML={\n Object {\n \"__html\": \"\",\n }\n }\n size=\"s\"\n />\n <div\n className=\"c18\"\n >\n \n <input\n aria-describedby=\"mship-1--moneyBuy-box3\"\n aria-label=\"\xA320\"\n className=\"c19\"\n id=\"mship-1--moneyBuy-box3\"\n name=\"mship-1--moneyBuy3\"\n onClick={[Function]}\n placeholder=\"\"\n required={false}\n type=\"button\"\n value=\"\xA3 20\"\n />\n </div>\n \n </label>\n </div>\n <div\n className=\"c21\"\n >\n <span\n className=\"c22 c23\"\n color=\"inherit\"\n size=\"s\"\n >\n Other amount\n </span>\n <label\n className=\"c14 c24\"\n htmlFor=\"mship-1--MoneyBuy-userInput\"\n >\n <span\n className=\"c16 c17\"\n color=\"inherit\"\n dangerouslySetInnerHTML={\n Object {\n \"__html\": \"\xA3\",\n }\n }\n size=\"s\"\n />\n <div\n className=\"c18\"\n >\n \n <input\n aria-describedby=\"mship-1--MoneyBuy-userInput\"\n aria-label=\"Input a different amount\"\n className=\"c19\"\n id=\"mship-1--MoneyBuy-userInput\"\n max=\"20000\"\n min=\"1\"\n name=\"membership_amount\"\n onChange={[Function]}\n onClick={[Function]}\n onKeyPress={[Function]}\n pattern=\"[^[0-9]+([,.][0-9]+)?$]\"\n placeholder=\"0.00\"\n required={false}\n step=\"0.01\"\n type=\"number\"\n value=\"\"\n />\n </div>\n \n </label>\n </div>\n <input\n className=\"c25\"\n type=\"submit\"\n value=\"Donate\"\n />\n <p\n className=\"c26\"\n />\n </fieldset>\n </form>\n </div>\n </div>\n </div>\n ");
|
|
32
|
+
expect(tree).toMatchInlineSnapshot("\n .c6 {\n font-size: 1.5rem;\n line-height: 1.5rem;\n text-transform: inherit;\n font-weight: 800;\n font-family: 'Montserrat',Helvetica,Arial,sans-serif;\n }\n\n .c7 {\n font-size: 1rem;\n line-height: 1rem;\n text-transform: inherit;\n line-height: normal;\n font-family: 'Montserrat',Helvetica,Arial,sans-serif;\n }\n\n .c12 {\n font-size: 1rem;\n line-height: 1rem;\n text-transform: inherit;\n font-family: 'Montserrat',Helvetica,Arial,sans-serif;\n }\n\n .c16 {\n font-size: 1rem;\n line-height: 1rem;\n text-transform: inherit;\n font-weight: bold;\n line-height: normal;\n font-family: 'Montserrat',Helvetica,Arial,sans-serif;\n }\n\n .c22 {\n font-size: 1rem;\n line-height: 1rem;\n text-transform: inherit;\n font-weight: 500;\n line-height: normal;\n font-family: 'Montserrat',Helvetica,Arial,sans-serif;\n }\n\n .c1 {\n display: block;\n width: 100%;\n height: 100%;\n position: relative;\n }\n\n .c3 {\n width: 100%;\n height: 100%;\n display: block;\n object-fit: cover;\n }\n\n .c14 {\n position: relative;\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-flex-direction: column;\n -ms-flex-direction: column;\n flex-direction: column;\n color: #5C5C5E;\n width: 100%;\n }\n\n .c17 {\n margin-bottom: 0.5rem;\n }\n\n .c19 {\n position: relative;\n box-sizing: border-box;\n width: 100%;\n height: 48px;\n padding: 1rem 1.5rem;\n background-color: #F4F3F5;\n border: 1px solid;\n border-color: #E1E2E3;\n box-shadow: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n color: #000000;\n border-radius: 0.5rem;\n font-size: inherit;\n z-index: 2;\n font-family: 'Montserrat',Helvetica,Arial,sans-serif;\n }\n\n .c19:focus {\n border: 1px solid #666;\n }\n\n .c18 {\n position: relative;\n font-size: 1.25rem;\n }\n\n .c15 {\n display: block;\n }\n\n .c15 input {\n border: 2px solid #E1E2E3;\n font-size: 1.5rem;\n font-weight: 800;\n -webkit-letter-spacing: -2px;\n -moz-letter-spacing: -2px;\n -ms-letter-spacing: -2px;\n letter-spacing: -2px;\n height: auto;\n }\n\n .c20 {\n display: block;\n }\n\n .c20 input {\n border: 2px solid #E1E2E3;\n font-size: 1.5rem;\n font-weight: 800;\n -webkit-letter-spacing: -2px;\n -moz-letter-spacing: -2px;\n -ms-letter-spacing: -2px;\n letter-spacing: -2px;\n height: auto;\n border-color: #E52630;\n background-color: #E52630;\n color: #FFFFFF;\n }\n\n .c0 {\n background-color: #FEE3CC;\n position: relative;\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -webkit-justify-content: center;\n -ms-flex-pack: center;\n justify-content: center;\n min-height: 100vh;\n }\n\n .c2 {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n height: auto;\n }\n\n .c2:before {\n color: #FEE3CC;\n content: '';\n position: absolute;\n width: 100%;\n height: 100%;\n box-shadow: inset 0px 4rem 2rem -2rem;\n }\n\n .c4 {\n position: relative;\n max-width: 320px;\n text-align: center;\n margin-bottom: 50%;\n }\n\n .c5 {\n padding: 2rem 1rem 0;\n margin-bottom: 2rem;\n }\n\n .c8 {\n background-color: #FFFFFF;\n box-shadow: 0px 1rem 4rem rgba(0,0,0,0.3);\n height: 450px;\n }\n\n .c9 {\n padding: 1rem;\n }\n\n .c9 h3 {\n margin-top: 1rem;\n }\n\n .c9 input {\n max-width: 100%;\n margin: 0;\n }\n\n .c10 {\n padding: 0;\n margin: 0;\n border: none;\n }\n\n .c10 >:not(:last-child):not(legend) {\n margin-bottom: 2rem;\n }\n\n .c11 {\n margin: 0;\n padding: 0;\n }\n\n .c13 {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: justify;\n -webkit-justify-content: space-between;\n -ms-flex-pack: justify;\n justify-content: space-between;\n }\n\n .c13 label {\n -webkit-flex: 0 0 30%;\n -ms-flex: 0 0 30%;\n flex: 0 0 30%;\n }\n\n .c13 label input {\n cursor: pointer;\n padding: 1rem;\n }\n\n .c13 label:hover input {\n border-color: #E52630;\n }\n\n .c21 {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-align-items: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n }\n\n .c23 {\n margin-right: auto;\n }\n\n .c24 {\n position: relative;\n -webkit-flex: 0 0 50%;\n -ms-flex: 0 0 50%;\n flex: 0 0 50%;\n font-weight: 400;\n display: block;\n }\n\n .c24 span {\n position: absolute;\n padding: 0px 15px;\n font-size: 20px;\n top: 50%;\n -webkit-transform: translateY(-50%);\n -ms-transform: translateY(-50%);\n transform: translateY(-50%);\n left: 0px;\n font-weight: 500;\n }\n\n .c24 input {\n border: 2px solid #E1E2E3;\n background: transparent;\n padding: 0.5rem 1rem 0.5rem 2rem;\n }\n\n .c24 input:focus {\n border: 2px solid #E52630;\n }\n\n .c26 {\n line-height: 1.5;\n }\n\n .c25 {\n width: 100%;\n color: #FFFFFF;\n font-size: 1rem;\n font-weight: bold;\n cursor: pointer;\n padding: 1rem 0.5rem;\n background: #E52630;\n border: none;\n border-radius: 100px;\n }\n\n .c25:active,\n .c25:focus,\n .c25:hover {\n background-color: #961D35;\n }\n\n @media (min-width:740px) {\n .c19 {\n max-width: 290px;\n }\n }\n\n @media (min-width:1024px) {\n .c0 {\n -webkit-align-items: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: inherit;\n -webkit-justify-content: inherit;\n -ms-flex-pack: inherit;\n justify-content: inherit;\n min-height: 750px;\n height: 100vh;\n max-height: 900px;\n -webkit-flex-direction: row;\n -ms-flex-direction: row;\n flex-direction: row;\n }\n }\n\n @media (min-width:1024px) {\n .c2 {\n height: 100%;\n }\n\n .c2:before {\n content: none;\n }\n }\n\n @media (min-width:1024px) {\n .c4 {\n margin: 0 8rem;\n max-width: 420px;\n }\n }\n\n @media (min-width:1024px) {\n .c8 {\n height: 430px;\n }\n }\n\n @media (min-width:1024px) {\n .c24 {\n -webkit-flex: 0 0 60%;\n -ms-flex: 0 0 60%;\n flex: 0 0 60%;\n }\n }\n\n @media (min-width:1024px) {\n .c25 {\n width: auto;\n padding: 1rem 2rem;\n margin: 0 auto 2rem;\n }\n }\n\n <div\n className=\"c0\"\n id=\"mship-1\"\n >\n <div\n className=\"c1 c2\"\n height=\"100%\"\n width=\"100%\"\n >\n <img\n alt=\"Background image\"\n className=\"c3 lazyload\"\n data-src={null}\n height=\"100%\"\n width=\"100%\"\n />\n </div>\n <div\n className=\"c4\"\n >\n <div\n className=\"c5\"\n >\n <h2\n className=\"c6\"\n color=\"inherit\"\n size=\"l\"\n >\n Help someone like Jordan see a better tomorrow\n </h2>\n <p\n className=\"c7\"\n color=\"inherit\"\n size=\"s\"\n >\n Jordan was close to suicide - which is now the biggest killer of men under 45 in the UK. Join now and help save lives.\n </p>\n </div>\n <div\n className=\"c8\"\n >\n <form\n className=\"c9\"\n onSubmit={[Function]}\n >\n <fieldset\n className=\"c10\"\n >\n <legend\n className=\"c11\"\n >\n <h3\n className=\"c12\"\n color=\"inherit\"\n size=\"s\"\n >\n Choose your monthly donation\n </h3>\n </legend>\n <div\n className=\"c13\"\n >\n <label\n className=\"c14 c15\"\n htmlFor=\"mship-1--moneyBuy-box1\"\n >\n <span\n className=\"c16 c17\"\n color=\"inherit\"\n dangerouslySetInnerHTML={\n Object {\n \"__html\": \"\",\n }\n }\n size=\"s\"\n />\n <div\n className=\"c18\"\n >\n \n <input\n aria-describedby=\"mship-1--moneyBuy-box1\"\n aria-label=\"\xA35\"\n className=\"c19\"\n id=\"mship-1--moneyBuy-box1\"\n name=\"mship-1--moneyBuy1\"\n onClick={[Function]}\n placeholder=\"\"\n required={false}\n type=\"button\"\n value=\"\xA3 5\"\n />\n </div>\n \n </label>\n <label\n className=\"c14 c20\"\n htmlFor=\"mship-1--moneyBuy-box2\"\n >\n <span\n className=\"c16 c17\"\n color=\"inherit\"\n dangerouslySetInnerHTML={\n Object {\n \"__html\": \"\",\n }\n }\n size=\"s\"\n />\n <div\n className=\"c18\"\n >\n \n <input\n aria-describedby=\"mship-1--moneyBuy-box2\"\n aria-label=\"\xA310\"\n className=\"c19\"\n id=\"mship-1--moneyBuy-box2\"\n name=\"mship-1--moneyBuy2\"\n onClick={[Function]}\n placeholder=\"\"\n required={false}\n type=\"button\"\n value=\"\xA3 10\"\n />\n </div>\n \n </label>\n <label\n className=\"c14 c15\"\n htmlFor=\"mship-1--moneyBuy-box3\"\n >\n <span\n className=\"c16 c17\"\n color=\"inherit\"\n dangerouslySetInnerHTML={\n Object {\n \"__html\": \"\",\n }\n }\n size=\"s\"\n />\n <div\n className=\"c18\"\n >\n \n <input\n aria-describedby=\"mship-1--moneyBuy-box3\"\n aria-label=\"\xA320\"\n className=\"c19\"\n id=\"mship-1--moneyBuy-box3\"\n name=\"mship-1--moneyBuy3\"\n onClick={[Function]}\n placeholder=\"\"\n required={false}\n type=\"button\"\n value=\"\xA3 20\"\n />\n </div>\n \n </label>\n </div>\n <div\n className=\"c21\"\n >\n <span\n className=\"c22 c23\"\n color=\"inherit\"\n size=\"s\"\n >\n Other amount\n </span>\n <label\n className=\"c14 c24\"\n htmlFor=\"mship-1--MoneyBuy-userInput\"\n >\n <span\n className=\"c16 c17\"\n color=\"inherit\"\n dangerouslySetInnerHTML={\n Object {\n \"__html\": \"\xA3\",\n }\n }\n size=\"s\"\n />\n <div\n className=\"c18\"\n >\n \n <input\n aria-describedby=\"mship-1--MoneyBuy-userInput\"\n aria-label=\"Input a different amount\"\n className=\"c19\"\n id=\"mship-1--MoneyBuy-userInput\"\n max=\"20000\"\n min=\"1\"\n name=\"membership_amount\"\n onChange={[Function]}\n onClick={[Function]}\n onKeyPress={[Function]}\n pattern=\"[^[0-9]+([,.][0-9]+)?$]\"\n placeholder=\"0.00\"\n required={false}\n step=\"0.01\"\n type=\"number\"\n value=\"\"\n />\n </div>\n \n </label>\n </div>\n <input\n className=\"c25\"\n type=\"submit\"\n value=\"Donate\"\n />\n <p\n className=\"c26\"\n />\n </fieldset>\n </form>\n </div>\n </div>\n </div>\n ");
|
|
33
33
|
});
|
package/dist/index.js
CHANGED
|
@@ -269,12 +269,6 @@ Object.defineProperty(exports, "VideoBanner", {
|
|
|
269
269
|
return _VideoBanner.default;
|
|
270
270
|
}
|
|
271
271
|
});
|
|
272
|
-
Object.defineProperty(exports, "HeaderEsuWithIcon", {
|
|
273
|
-
enumerable: true,
|
|
274
|
-
get: function get() {
|
|
275
|
-
return _HeaderEsuWithIcon.default;
|
|
276
|
-
}
|
|
277
|
-
});
|
|
278
272
|
Object.defineProperty(exports, "Icon", {
|
|
279
273
|
enumerable: true,
|
|
280
274
|
get: function get() {
|
|
@@ -350,7 +344,19 @@ Object.defineProperty(exports, "SimpleSchoolLookup", {
|
|
|
350
344
|
Object.defineProperty(exports, "EmailSignUp", {
|
|
351
345
|
enumerable: true,
|
|
352
346
|
get: function get() {
|
|
353
|
-
return _EmailSignUp.
|
|
347
|
+
return _EmailSignUp.EmailSignUp;
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
Object.defineProperty(exports, "buildEsuValidationSchema", {
|
|
351
|
+
enumerable: true,
|
|
352
|
+
get: function get() {
|
|
353
|
+
return _EmailSignUp.buildEsuValidationSchema;
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
Object.defineProperty(exports, "ESU_FIELDS", {
|
|
357
|
+
enumerable: true,
|
|
358
|
+
get: function get() {
|
|
359
|
+
return _EmailSignUp.ESU_FIELDS;
|
|
354
360
|
}
|
|
355
361
|
});
|
|
356
362
|
Object.defineProperty(exports, "CookieBanner", {
|
|
@@ -468,8 +474,6 @@ var _ShareButton = _interopRequireDefault(require("./components/Molecules/ShareB
|
|
|
468
474
|
|
|
469
475
|
var _VideoBanner = _interopRequireDefault(require("./components/Molecules/VideoBanner/VideoBanner"));
|
|
470
476
|
|
|
471
|
-
var _HeaderEsuWithIcon = _interopRequireDefault(require("./components/Molecules/HeaderEsuWithIcon/HeaderEsuWithIcon"));
|
|
472
|
-
|
|
473
477
|
var _Icon = _interopRequireDefault(require("./components/Atoms/SocialIcons/Icon/Icon"));
|
|
474
478
|
|
|
475
479
|
var _Typeahead = _interopRequireDefault(require("./components/Molecules/Typeahead/Typeahead"));
|
|
@@ -494,7 +498,7 @@ var _Lookup = _interopRequireDefault(require("./components/Molecules/Lookup/Look
|
|
|
494
498
|
|
|
495
499
|
var _SimpleSchoolLookup = _interopRequireDefault(require("./components/Molecules/SimpleSchoolLookup/SimpleSchoolLookup"));
|
|
496
500
|
|
|
497
|
-
var _EmailSignUp =
|
|
501
|
+
var _EmailSignUp = require("./components/Organisms/EmailSignUp/_EmailSignUp");
|
|
498
502
|
|
|
499
503
|
var _CookieBanner = _interopRequireDefault(require("./components/Organisms/CookieBanner/CookieBanner"));
|
|
500
504
|
|
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": "
|
|
4
|
+
"version": "7.0.0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"license": "ISC",
|
|
7
7
|
"jest": {
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"moment": "^2.29.1",
|
|
31
31
|
"prop-types": "^15.7.2",
|
|
32
32
|
"react": "^17.0.2",
|
|
33
|
+
"react-canvas-confetti": "^1.3.0",
|
|
33
34
|
"react-currency-format": "^1.0.0",
|
|
34
35
|
"react-dom": "^17.0.2",
|
|
35
36
|
"react-hook-form": "^6.3.0",
|
|
@@ -22,7 +22,7 @@ const Image = styled.div`
|
|
|
22
22
|
height: auto;
|
|
23
23
|
flex-basis: calc(100% / 3);
|
|
24
24
|
img {
|
|
25
|
-
border-radius: ${props => (props.
|
|
25
|
+
border-radius: ${props => (props.squaredCorners ? '0' : '1rem')};
|
|
26
26
|
overflow: hidden;
|
|
27
27
|
}
|
|
28
28
|
`;
|
|
@@ -51,12 +51,12 @@ const Box = ({
|
|
|
51
51
|
height,
|
|
52
52
|
width,
|
|
53
53
|
children,
|
|
54
|
-
|
|
54
|
+
squaredCorners,
|
|
55
55
|
...rest
|
|
56
56
|
}) => (
|
|
57
57
|
<Container {...rest}>
|
|
58
58
|
{imageLow ? (
|
|
59
|
-
<Image
|
|
59
|
+
<Image squaredCorners={squaredCorners}>
|
|
60
60
|
<Picture
|
|
61
61
|
alt={imageAltText}
|
|
62
62
|
imageLow={imageLow}
|
|
@@ -64,7 +64,7 @@ const Box = ({
|
|
|
64
64
|
image={image}
|
|
65
65
|
width={width}
|
|
66
66
|
height="auto"
|
|
67
|
-
|
|
67
|
+
squaredCorners={squaredCorners}
|
|
68
68
|
/>
|
|
69
69
|
</Image>
|
|
70
70
|
) : null}
|
|
@@ -80,7 +80,7 @@ Box.propTypes = {
|
|
|
80
80
|
height: PropTypes.string,
|
|
81
81
|
imageAltText: PropTypes.string,
|
|
82
82
|
children: PropTypes.node,
|
|
83
|
-
|
|
83
|
+
squaredCorners: PropTypes.bool
|
|
84
84
|
};
|
|
85
85
|
|
|
86
86
|
Box.defaultProps = {
|
|
@@ -91,7 +91,7 @@ Box.defaultProps = {
|
|
|
91
91
|
imageAltText: '',
|
|
92
92
|
width: '100%',
|
|
93
93
|
height: '100%',
|
|
94
|
-
|
|
94
|
+
squaredCorners: false
|
|
95
95
|
};
|
|
96
96
|
|
|
97
97
|
export default Box;
|
|
@@ -9,7 +9,7 @@ const Container = styled.div`
|
|
|
9
9
|
position: relative;
|
|
10
10
|
flex-direction: column;
|
|
11
11
|
height: 100%;
|
|
12
|
-
border-radius: ${props => (props.
|
|
12
|
+
border-radius: ${props => (props.squaredCorners ? '0' : '1rem')};
|
|
13
13
|
overflow: hidden;
|
|
14
14
|
background: ${({ theme, backgroundColor }) => theme.color(backgroundColor)};
|
|
15
15
|
`;
|
|
@@ -33,10 +33,10 @@ const Card = ({
|
|
|
33
33
|
height,
|
|
34
34
|
width,
|
|
35
35
|
children,
|
|
36
|
-
|
|
36
|
+
squaredCorners,
|
|
37
37
|
...rest
|
|
38
38
|
}) => (
|
|
39
|
-
<Container backgroundColor={backgroundColor}
|
|
39
|
+
<Container backgroundColor={backgroundColor} squaredCorners={squaredCorners} {...rest}>
|
|
40
40
|
{imageLow ? (
|
|
41
41
|
<Image>
|
|
42
42
|
<Picture
|
|
@@ -63,7 +63,7 @@ Card.propTypes = {
|
|
|
63
63
|
height: PropTypes.string,
|
|
64
64
|
imageAltText: PropTypes.string,
|
|
65
65
|
children: PropTypes.node,
|
|
66
|
-
|
|
66
|
+
squaredCorners: PropTypes.bool
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
Card.defaultProps = {
|
|
@@ -75,7 +75,7 @@ Card.defaultProps = {
|
|
|
75
75
|
imageAltText: '',
|
|
76
76
|
width: '100%',
|
|
77
77
|
height: '100%',
|
|
78
|
-
|
|
78
|
+
squaredCorners: false
|
|
79
79
|
};
|
|
80
80
|
|
|
81
81
|
export default Card;
|
|
@@ -1,129 +1,14 @@
|
|
|
1
|
-
# Email
|
|
1
|
+
# Email SignUp Form
|
|
2
2
|
|
|
3
|
-
```js
|
|
4
|
-
import RichText from '../../Atoms/RichText/RichText';
|
|
5
|
-
|
|
6
|
-
const title = 'Stay in the know!';
|
|
7
|
-
const topCopy = (
|
|
8
|
-
<RichText
|
|
9
|
-
markup={`<p>Get regular email updates and info on what we're up to!</p>`}
|
|
10
|
-
/>
|
|
11
|
-
);
|
|
12
|
-
const privacyCopy = (
|
|
13
|
-
<RichText
|
|
14
|
-
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>`}
|
|
15
|
-
/>
|
|
16
|
-
);
|
|
17
|
-
const successCopy = (
|
|
18
|
-
<RichText
|
|
19
|
-
markup={`<p>Thanks! Your first email will be with you shortly</p>`}
|
|
20
|
-
/>
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
const [success, setSuccess] = React.useState(false);
|
|
24
|
-
const [error, setError] = React.useState('');
|
|
25
|
-
|
|
26
|
-
const sendEmail = email => {
|
|
27
|
-
setTimeout(() => setSuccess(!success), 2000);
|
|
28
|
-
console.log(email);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const validate = ({ email }) => {
|
|
32
|
-
let isValid = false;
|
|
33
|
-
if (email.includes('@')) {
|
|
34
|
-
isValid = true;
|
|
35
|
-
setError('');
|
|
36
|
-
} else {
|
|
37
|
-
setError('invalid email!');
|
|
38
|
-
}
|
|
39
|
-
return isValid;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
<EmailSignUp
|
|
43
|
-
title={title}
|
|
44
|
-
topCopy={topCopy}
|
|
45
|
-
successCopy={successCopy}
|
|
46
|
-
isSuccess={success}
|
|
47
|
-
privacyCopy={privacyCopy}
|
|
48
|
-
errorMsg={error}
|
|
49
|
-
subscribe={sendEmail}
|
|
50
|
-
validate={validate}
|
|
51
|
-
/>;
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
# Email Sign Up Schools
|
|
55
3
|
|
|
56
4
|
```js
|
|
57
|
-
import
|
|
58
|
-
|
|
59
|
-
const title = 'Stay in the know!';
|
|
60
|
-
const topCopy = (
|
|
61
|
-
<RichText
|
|
62
|
-
markup={`<p>Get regular email updates and info on what we're up to!</p>`}
|
|
63
|
-
/>
|
|
64
|
-
);
|
|
65
|
-
const privacyCopy = (
|
|
66
|
-
<RichText
|
|
67
|
-
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>`}
|
|
68
|
-
/>
|
|
69
|
-
);
|
|
70
|
-
const successCopy = (
|
|
71
|
-
<RichText
|
|
72
|
-
markup={`<p>Thanks! Your first email will be with you shortly</p>`}
|
|
73
|
-
/>
|
|
74
|
-
);
|
|
75
|
-
const selectItems = [
|
|
76
|
-
{ value: '', displayValue: '-- Select age group --' },
|
|
77
|
-
{ value: 'Option one', displayValue: 'The first option' },
|
|
78
|
-
{
|
|
79
|
-
value: 'Option two',
|
|
80
|
-
displayValue: 'The second option'
|
|
81
|
-
},
|
|
82
|
-
{ value: 'Option three', displayValue: 'The third option' },
|
|
83
|
-
{ value: 'Option four', displayValue: 'The fourth option' }
|
|
84
|
-
];
|
|
85
|
-
|
|
86
|
-
const [successSchools, setSuccessSchools] = React.useState(false);
|
|
87
|
-
const [error, setError] = React.useState('');
|
|
88
|
-
|
|
89
|
-
sendEmail = emailAndAge => {
|
|
90
|
-
setTimeout(
|
|
91
|
-
() => setSuccessSchools(!successSchools),
|
|
92
|
-
2000
|
|
93
|
-
);
|
|
94
|
-
console.log(emailAndAge);
|
|
95
|
-
};
|
|
5
|
+
import EmailSignUpForm from './EmailSignUpForm';
|
|
6
|
+
import Text from '../../Atoms/Text/Text';
|
|
96
7
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
} else {
|
|
103
|
-
setError('invalid email!');
|
|
104
|
-
}
|
|
105
|
-
if (isValid === true && typeof age !== 'undefined') {
|
|
106
|
-
if (age) {
|
|
107
|
-
setError('');
|
|
108
|
-
} else {
|
|
109
|
-
isValid = false;
|
|
110
|
-
setError('invalid age!');
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return isValid;
|
|
114
|
-
};
|
|
8
|
+
<>
|
|
9
|
+
<Text tag="p">This EmailSignUpForm component exists purely to show the EmailSignUp component functioning within the Component Library; applications are to provide their own react-hook-form form and validation, based on these.</Text>
|
|
10
|
+
|
|
11
|
+
<EmailSignUpForm />
|
|
12
|
+
</>
|
|
115
13
|
|
|
116
|
-
<EmailSignUp
|
|
117
|
-
title={title}
|
|
118
|
-
topCopy={topCopy}
|
|
119
|
-
successCopy={successCopy}
|
|
120
|
-
schoolsCopy="Now please select your teaching group so you get the right updates."
|
|
121
|
-
isSuccess={successSchools}
|
|
122
|
-
selectItems={selectItems}
|
|
123
|
-
isSchools
|
|
124
|
-
privacyCopy={privacyCopy}
|
|
125
|
-
errorMsg={error}
|
|
126
|
-
subscribe={sendEmail}
|
|
127
|
-
validate={validate}
|
|
128
|
-
/>;
|
|
129
14
|
```
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
|
|
3
3
|
import spacing from '../../../theme/shared/spacing';
|
|
4
|
-
import
|
|
4
|
+
import TextInput from './_TextInput';
|
|
5
5
|
import Text from '../../Atoms/Text/Text';
|
|
6
6
|
|
|
7
7
|
const ESUWrapper = styled.div`
|
|
@@ -9,7 +9,8 @@ const ESUWrapper = styled.div`
|
|
|
9
9
|
flex-direction: column;
|
|
10
10
|
font-size: ${({ theme }) => theme.fontSize('s')};
|
|
11
11
|
color: ${({ theme }) => theme.color('white')};
|
|
12
|
-
background-color: ${({ theme,
|
|
12
|
+
background-color: ${({ theme, backgroundColour }) => theme.color(backgroundColour)};
|
|
13
|
+
padding: ${spacing('m')};
|
|
13
14
|
`;
|
|
14
15
|
|
|
15
16
|
const TopCopyWrapper = styled.div`
|
|
@@ -19,14 +20,8 @@ const TopCopyWrapper = styled.div`
|
|
|
19
20
|
|
|
20
21
|
const ButtonWrapper = styled.div`
|
|
21
22
|
margin-top: ${spacing('md')};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
width: 100%;
|
|
25
|
-
font-size: ${({ theme }) => theme.fontSize('s')};
|
|
26
|
-
@media ${({ theme }) => theme.breakpoint('small')} {
|
|
27
|
-
font-size: ${({ theme }) => theme.fontSize('m')};
|
|
28
|
-
max-width: 180px;
|
|
29
|
-
}
|
|
23
|
+
button {
|
|
24
|
+
background-color: ${({ theme, buttonColour }) => theme.color(buttonColour)};
|
|
30
25
|
}
|
|
31
26
|
`;
|
|
32
27
|
|
|
@@ -34,6 +29,7 @@ const PrivacyCopyWrapper = styled.div`
|
|
|
34
29
|
display: flex;
|
|
35
30
|
flex-direction: column;
|
|
36
31
|
margin-top: ${spacing('md')};
|
|
32
|
+
|
|
37
33
|
p {
|
|
38
34
|
font-size: ${({ theme }) => theme.fontSize('s')};
|
|
39
35
|
line-height: ${({ theme }) => theme.fontSize('xl')};
|
|
@@ -44,14 +40,37 @@ const PrivacyCopyWrapper = styled.div`
|
|
|
44
40
|
}
|
|
45
41
|
`;
|
|
46
42
|
|
|
47
|
-
const
|
|
43
|
+
const FormInner = styled.div`
|
|
48
44
|
display: flex;
|
|
49
45
|
flex-direction: column;
|
|
50
46
|
margin: ${spacing('md')} 0;
|
|
51
47
|
`;
|
|
52
48
|
|
|
53
|
-
const
|
|
49
|
+
const NameWrapper = styled.div`
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-direction: column;
|
|
52
|
+
gap: 0;
|
|
53
|
+
|
|
54
|
+
@media ${({ theme }) => theme.breakpoint('medium')} {
|
|
55
|
+
justify-content: start;
|
|
56
|
+
flex-direction: ${({ columnLayout }) => (columnLayout ? 'column' : 'row')};
|
|
57
|
+
gap: ${({ columnLayout }) => (columnLayout ? 0 : spacing('md'))};
|
|
58
|
+
)};
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
`;
|
|
62
|
+
|
|
63
|
+
const InputField = styled(TextInput)`
|
|
54
64
|
width: 100%;
|
|
65
|
+
margin-bottom: ${spacing('md')};
|
|
66
|
+
|
|
67
|
+
& > span:first-child {
|
|
68
|
+
color: ${({ theme }) => theme.color('white')};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@media ${({ theme }) => theme.breakpoint('medium')} {
|
|
72
|
+
max-width: 290px;
|
|
73
|
+
}
|
|
55
74
|
`;
|
|
56
75
|
|
|
57
76
|
const Title = styled(Text)`
|
|
@@ -63,7 +82,8 @@ export {
|
|
|
63
82
|
TopCopyWrapper,
|
|
64
83
|
PrivacyCopyWrapper,
|
|
65
84
|
ButtonWrapper,
|
|
66
|
-
|
|
85
|
+
FormInner,
|
|
67
86
|
InputField,
|
|
87
|
+
NameWrapper,
|
|
68
88
|
Title
|
|
69
89
|
};
|
|
@@ -1,76 +1,42 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "jest-styled-components";
|
|
3
|
+
import renderWithTheme from "../../../hoc/shallowWithTheme";
|
|
4
|
+
import { EmailSignUp, validationSchema } from "./_EmailSignUp";
|
|
5
|
+
import RichText from "../../Atoms/RichText/RichText";
|
|
6
|
+
import { useForm, FormProvider } from "react-hook-form";
|
|
7
|
+
import { yupResolver } from "@hookform/resolvers/yup";
|
|
7
8
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
const tree = renderWithTheme(
|
|
15
|
-
<>
|
|
16
|
-
<EmailSignUp
|
|
17
|
-
title="sign up letter"
|
|
18
|
-
topCopy={<RichText markup={top} />}
|
|
19
|
-
successCopy={<RichText markup={success} />}
|
|
20
|
-
isSuccess={false}
|
|
21
|
-
errorMsg=""
|
|
22
|
-
buttonColor="teal"
|
|
23
|
-
privacyCopy={<RichText markup={privacy} />}
|
|
24
|
-
subscribe={() => 'Done'}
|
|
25
|
-
validate={() => true}
|
|
26
|
-
/>
|
|
27
|
-
</>
|
|
28
|
-
).toJSON();
|
|
9
|
+
const DummyForm = () => {
|
|
10
|
+
const formMethods = useForm({
|
|
11
|
+
mode: "onBlur",
|
|
12
|
+
resolver: yupResolver(validationSchema),
|
|
13
|
+
});
|
|
14
|
+
const { handleSubmit } = formMethods;
|
|
29
15
|
|
|
30
|
-
|
|
31
|
-
|
|
16
|
+
const top =
|
|
17
|
+
"<h1> Top Copy</h1> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>";
|
|
18
|
+
const success =
|
|
19
|
+
"<h1> Success Copy</h1> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>";
|
|
20
|
+
const privacy =
|
|
21
|
+
'check <a href="https://www.comicrelief.com/privacy-notice">Privacy policy</a>';
|
|
32
22
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
{ value: 'Option four', displayValue: 'The fourth option' }
|
|
46
|
-
];
|
|
47
|
-
const mockNext = jest.fn();
|
|
48
|
-
const tree = renderWithTheme(
|
|
49
|
-
<>
|
|
50
|
-
<EmailSignUp
|
|
51
|
-
title="sign up letter"
|
|
52
|
-
topCopy={<RichText markup={top} />}
|
|
53
|
-
successCopy={<RichText markup={success} />}
|
|
54
|
-
schoolsCopy="Now please select your teaching group so you get the right updates."
|
|
55
|
-
selectItems={selectItems}
|
|
56
|
-
isSuccess={false}
|
|
57
|
-
isSchools
|
|
58
|
-
errorMsg=""
|
|
59
|
-
buttonColor="teal"
|
|
60
|
-
privacyCopy={<RichText markup={privacy} />}
|
|
61
|
-
subscribe={mockNext}
|
|
62
|
-
validate={() => true}
|
|
63
|
-
/>
|
|
64
|
-
</>
|
|
23
|
+
return (
|
|
24
|
+
<FormProvider {...formMethods}>
|
|
25
|
+
<form onSubmit={handleSubmit(() => true)} noValidate>
|
|
26
|
+
<EmailSignUp
|
|
27
|
+
title="sign up letter"
|
|
28
|
+
topCopy={<RichText markup={top} />}
|
|
29
|
+
successCopy={<RichText markup={success} />}
|
|
30
|
+
privacyCopy={<RichText markup={privacy} />}
|
|
31
|
+
formContext={formMethods}
|
|
32
|
+
/>
|
|
33
|
+
</form>
|
|
34
|
+
</FormProvider>
|
|
65
35
|
);
|
|
66
|
-
|
|
67
|
-
input.value = 'test@test.com';
|
|
36
|
+
};
|
|
68
37
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
tree.root.findAllByType('input')[1].props.onClick();
|
|
72
|
-
});
|
|
38
|
+
it("renders correctly", () => {
|
|
39
|
+
const tree = renderWithTheme(<DummyForm />).toJSON();
|
|
73
40
|
|
|
74
|
-
|
|
75
|
-
expect(treeJson).toMatchSnapshot();
|
|
41
|
+
expect(tree).toMatchSnapshot();
|
|
76
42
|
});
|