@comicrelief/component-library 6.10.0 → 7.0.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/cypress/integration/components/Organisms/Donate.spec.js +13 -13
- package/cypress/integration/components/Organisms/EmailSignUp.spec.js +47 -132
- package/dist/components/Organisms/Donate/Donate.md +9 -9
- package/dist/components/Organisms/Donate/Form/Form.js +2 -1
- package/dist/components/Organisms/Donate/GivingSelector/GivingSelector.js +17 -71
- package/dist/components/Organisms/Donate/GivingSelector/GivingSelector.style.js +71 -0
- package/dist/components/Organisms/Donate/__snapshots__/Donate.test.js.snap +11 -25
- 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/Organisms/Donate/Donate.md +9 -9
- package/src/components/Organisms/Donate/Form/Form.js +1 -0
- package/src/components/Organisms/Donate/GivingSelector/GivingSelector.js +15 -85
- package/src/components/Organisms/Donate/GivingSelector/GivingSelector.style.js +78 -0
- package/src/components/Organisms/Donate/__snapshots__/Donate.test.js.snap +11 -25
- 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
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import EmailIcon from './icon--email.svg';
|
|
2
|
-
import CloseIcon from './icon--close.svg';
|
|
3
|
-
|
|
4
|
-
const HeaderIcons = {
|
|
5
|
-
email: {
|
|
6
|
-
icon: EmailIcon,
|
|
7
|
-
title: 'Sign up for emails'
|
|
8
|
-
},
|
|
9
|
-
close: {
|
|
10
|
-
icon: CloseIcon,
|
|
11
|
-
title: 'Close email sign-up'
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default HeaderIcons;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
<svg id="icon--close" xmlns="http://www.w3.org/2000/svg" x="0" y="0" viewBox="3 3 32 32" xml:space="preserve">
|
|
2
|
-
<title>Email Sign-Up</title>
|
|
3
|
-
<desc>Close email Sign-Up form</desc>
|
|
4
|
-
<path fill="white" d="M21.4,20l8.3,8.3l-1.4,1.4L20,21.4l-8.3,8.3l-1.4-1.4l8.3-8.3l-8.3-8.3l1.4-1.4l8.3,8.3l8.3-8.3l1.4,1.4L21.4,20z"></path>
|
|
5
|
-
</svg>
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
<svg id="icon--email" xmlns="http://www.w3.org/2000/svg" x="0" y="0" viewBox="10 10 20 20" xml:space="preserve">
|
|
2
|
-
<title>Email Sign-Up</title>
|
|
3
|
-
<desc>Opens Email Sign-Up form</desc>
|
|
4
|
-
<path id="path--email" d="M28,12H12h-2v2v12v2h2h16h2v-2V14v-2H28z M26.6,14L20,20.6L13.4,14H26.6z M12,26V15.4l8,8l8-8V26H12z"></path>
|
|
5
|
-
</svg>
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
import Select from '../../Atoms/Select/Select';
|
|
5
|
-
import Text from '../../Atoms/Text/Text';
|
|
6
|
-
import {
|
|
7
|
-
ESUWrapper,
|
|
8
|
-
TopCopyWrapper,
|
|
9
|
-
Form,
|
|
10
|
-
PrivacyCopyWrapper,
|
|
11
|
-
InputField,
|
|
12
|
-
ButtonWrapper,
|
|
13
|
-
Title
|
|
14
|
-
} from './EmailSignUp.style';
|
|
15
|
-
import { Button } from '../Membership/Membership.style';
|
|
16
|
-
|
|
17
|
-
const EmailSignUp = ({
|
|
18
|
-
title,
|
|
19
|
-
topCopy,
|
|
20
|
-
isSuccess,
|
|
21
|
-
isSchools,
|
|
22
|
-
schoolsCopy,
|
|
23
|
-
selectItems,
|
|
24
|
-
successCopy,
|
|
25
|
-
errorMsg,
|
|
26
|
-
privacyCopy,
|
|
27
|
-
subscribe,
|
|
28
|
-
validate,
|
|
29
|
-
buttonColor,
|
|
30
|
-
backgroundColor,
|
|
31
|
-
...rest
|
|
32
|
-
}) => {
|
|
33
|
-
const [value, setValue] = useState('');
|
|
34
|
-
const [age, setAge] = useState('');
|
|
35
|
-
const [next, setNext] = useState(false);
|
|
36
|
-
|
|
37
|
-
const handleSubmit = e => {
|
|
38
|
-
// Just stopping weird things happening for now when the user submits with the enter key
|
|
39
|
-
// rather than the Submit button
|
|
40
|
-
e.preventDefault();
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const schoolsSelect = (
|
|
44
|
-
<>
|
|
45
|
-
<Select
|
|
46
|
-
hideLabel
|
|
47
|
-
label="Please choose an option"
|
|
48
|
-
placeholder="Please choose an option"
|
|
49
|
-
description="Please choose an option"
|
|
50
|
-
errorMsg={errorMsg}
|
|
51
|
-
options={selectItems}
|
|
52
|
-
value={age}
|
|
53
|
-
onChange={event => setAge(event.target.value)}
|
|
54
|
-
/>
|
|
55
|
-
<Text tag="p" weight="400" size="m">
|
|
56
|
-
{schoolsCopy}
|
|
57
|
-
</Text>
|
|
58
|
-
</>
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
const subscriptionSchoolsForm = (
|
|
62
|
-
<Form onSubmit={e => handleSubmit(e)}>
|
|
63
|
-
{!next && (
|
|
64
|
-
<>
|
|
65
|
-
<InputField
|
|
66
|
-
aria-label="Email address"
|
|
67
|
-
name="email"
|
|
68
|
-
id="email"
|
|
69
|
-
hasAria={false}
|
|
70
|
-
showLabel={false}
|
|
71
|
-
type="email"
|
|
72
|
-
errorMsg={errorMsg}
|
|
73
|
-
label="email"
|
|
74
|
-
placeholder="example@youremail.com"
|
|
75
|
-
value={value}
|
|
76
|
-
onChange={event => setValue(event.target.value)}
|
|
77
|
-
/>
|
|
78
|
-
<ButtonWrapper>
|
|
79
|
-
<Button
|
|
80
|
-
as="input"
|
|
81
|
-
type="submit"
|
|
82
|
-
data-test="subscribe-button-school"
|
|
83
|
-
color={buttonColor}
|
|
84
|
-
onClick={() => validate({ email: value }) && setNext(true)}
|
|
85
|
-
value=" Subscribe"
|
|
86
|
-
/>
|
|
87
|
-
</ButtonWrapper>
|
|
88
|
-
</>
|
|
89
|
-
)}
|
|
90
|
-
{next && (
|
|
91
|
-
<>
|
|
92
|
-
{schoolsSelect}
|
|
93
|
-
<ButtonWrapper>
|
|
94
|
-
<Button
|
|
95
|
-
as="input"
|
|
96
|
-
type="submit"
|
|
97
|
-
data-test="subscribe-button-school"
|
|
98
|
-
color={buttonColor}
|
|
99
|
-
onClick={() => validate({ email: value, age })
|
|
100
|
-
&& subscribe({ email: `${value}`, age: `${age}` })
|
|
101
|
-
}
|
|
102
|
-
value=" Subscribe"
|
|
103
|
-
/>
|
|
104
|
-
</ButtonWrapper>
|
|
105
|
-
</>
|
|
106
|
-
)}
|
|
107
|
-
</Form>
|
|
108
|
-
);
|
|
109
|
-
|
|
110
|
-
const subscriptionForm = (
|
|
111
|
-
<Form onSubmit={e => handleSubmit(e)}>
|
|
112
|
-
<InputField
|
|
113
|
-
aria-label="Email address"
|
|
114
|
-
name="email"
|
|
115
|
-
id="email"
|
|
116
|
-
hasAria={false}
|
|
117
|
-
showLabel={false}
|
|
118
|
-
type="email"
|
|
119
|
-
errorMsg={errorMsg}
|
|
120
|
-
label="email"
|
|
121
|
-
placeholder="example@youremail.com"
|
|
122
|
-
value={value}
|
|
123
|
-
onChange={event => setValue(event.target.value)}
|
|
124
|
-
/>
|
|
125
|
-
<ButtonWrapper>
|
|
126
|
-
<Button
|
|
127
|
-
as="input"
|
|
128
|
-
data-test="subscribe-button"
|
|
129
|
-
type="submit"
|
|
130
|
-
color={buttonColor}
|
|
131
|
-
onClick={() => validate({ email: value }) && subscribe(value)}
|
|
132
|
-
value=" Subscribe"
|
|
133
|
-
/>
|
|
134
|
-
</ButtonWrapper>
|
|
135
|
-
</Form>
|
|
136
|
-
);
|
|
137
|
-
|
|
138
|
-
const privacyContainer = (
|
|
139
|
-
<PrivacyCopyWrapper>{privacyCopy}</PrivacyCopyWrapper>
|
|
140
|
-
);
|
|
141
|
-
|
|
142
|
-
return (
|
|
143
|
-
<ESUWrapper backgroundColor={backgroundColor} {...rest}>
|
|
144
|
-
<Title tag="h2" size="xxl" weight="400" family="Anton" uppercase>
|
|
145
|
-
{title}
|
|
146
|
-
</Title>
|
|
147
|
-
{(!next || isSuccess) && (
|
|
148
|
-
<TopCopyWrapper>{isSuccess ? successCopy : topCopy}</TopCopyWrapper>
|
|
149
|
-
)}
|
|
150
|
-
{!isSuccess && (isSchools ? subscriptionSchoolsForm : subscriptionForm)}
|
|
151
|
-
{privacyContainer}
|
|
152
|
-
</ESUWrapper>
|
|
153
|
-
);
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
EmailSignUp.propTypes = {
|
|
157
|
-
/** title */
|
|
158
|
-
title: PropTypes.string.isRequired,
|
|
159
|
-
/** top copy */
|
|
160
|
-
topCopy: PropTypes.node.isRequired,
|
|
161
|
-
/** displayed copy when subscription is successful */
|
|
162
|
-
successCopy: PropTypes.node.isRequired,
|
|
163
|
-
/** boolean if true display successCopy */
|
|
164
|
-
isSuccess: PropTypes.bool.isRequired,
|
|
165
|
-
/** boolean if true display schools dropdown */
|
|
166
|
-
isSchools: PropTypes.bool,
|
|
167
|
-
/** email error message */
|
|
168
|
-
errorMsg: PropTypes.string.isRequired,
|
|
169
|
-
/** privacy copy */
|
|
170
|
-
privacyCopy: PropTypes.node.isRequired,
|
|
171
|
-
/** privacy copy */
|
|
172
|
-
schoolsCopy: PropTypes.node,
|
|
173
|
-
selectItems: PropTypes.PropTypes.arrayOf(
|
|
174
|
-
PropTypes.shape({
|
|
175
|
-
value: PropTypes.string.isRequired,
|
|
176
|
-
displayValue: PropTypes.string.isRequired
|
|
177
|
-
})
|
|
178
|
-
),
|
|
179
|
-
/** subscription function */
|
|
180
|
-
subscribe: PropTypes.func.isRequired,
|
|
181
|
-
/** validation function */
|
|
182
|
-
validate: PropTypes.func.isRequired,
|
|
183
|
-
/** background color */
|
|
184
|
-
backgroundColor: PropTypes.string,
|
|
185
|
-
/** button color */
|
|
186
|
-
buttonColor: PropTypes.string
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
EmailSignUp.defaultProps = {
|
|
190
|
-
backgroundColor: 'deep_violet_dark',
|
|
191
|
-
buttonColor: 'red',
|
|
192
|
-
isSchools: false,
|
|
193
|
-
schoolsCopy: '',
|
|
194
|
-
selectItems: []
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
export default EmailSignUp;
|