@comicrelief/component-library 7.4.0 → 7.5.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.
@@ -31,7 +31,10 @@ var Donate = function Donate(_ref) {
31
31
  var alt = _ref.alt,
32
32
  cartID = _ref.cartID,
33
33
  clientID = _ref.clientID,
34
+ overlayColor = _ref.overlayColor,
34
35
  backgroundColor = _ref.backgroundColor,
36
+ buttonColor = _ref.buttonColor,
37
+ textColor = _ref.textColor,
35
38
  donateLink = _ref.donateLink,
36
39
  data = _ref.data,
37
40
  title = _ref.title,
@@ -68,6 +71,7 @@ var Donate = function Donate(_ref) {
68
71
  isDesktop = overrideValue !== null ? overrideValue : isDesktop;
69
72
  return /*#__PURE__*/_react.default.createElement(_Donate.Container, {
70
73
  backgroundColor: backgroundColor,
74
+ overlayColor: overlayColor,
71
75
  id: mbshipID,
72
76
  key: overrideValue
73
77
  }, !isDesktop && mobileImages ? /*#__PURE__*/_react.default.createElement(_Picture.default, {
@@ -80,7 +84,7 @@ var Donate = function Donate(_ref) {
80
84
  height: "100%",
81
85
  alt: mobileAlt
82
86
  }) : null, isDesktop && images ? /*#__PURE__*/_react.default.createElement(_Donate.BgImage, {
83
- backgroundColor: backgroundColor,
87
+ backgroundColor: overlayColor,
84
88
  image: image,
85
89
  images: images,
86
90
  imageLow: imageLow,
@@ -96,14 +100,14 @@ var Donate = function Donate(_ref) {
96
100
  formAlignRight: formAlignRight
97
101
  }, /*#__PURE__*/_react.default.createElement(_Donate.HeaderInner, null, subtitle && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Text.default, {
98
102
  tag: "h2",
99
- color: "white",
103
+ color: textColor,
100
104
  size: "big",
101
105
  family: "Anton",
102
106
  weight: "normal",
103
107
  uppercase: true
104
108
  }, title), /*#__PURE__*/_react.default.createElement(_Text.default, {
105
109
  tag: "p",
106
- color: "white",
110
+ color: textColor,
107
111
  size: "m"
108
112
  }, subtitle)))), /*#__PURE__*/_react.default.createElement(_Form.default, {
109
113
  data: data,
@@ -114,7 +118,8 @@ var Donate = function Donate(_ref) {
114
118
  donateLink: donateLink,
115
119
  noMoneyBuys: noMoneyBuys,
116
120
  PopUpText: PopUpText,
117
- chooseAmountText: chooseAmountText
121
+ chooseAmountText: chooseAmountText,
122
+ buttonColor: buttonColor
118
123
  })));
119
124
  };
120
125
 
@@ -129,7 +134,10 @@ Donate.defaultProps = {
129
134
  mobileImage: null,
130
135
  mobileImages: null,
131
136
  mobileAlt: '',
137
+ overlayColor: 'transparent',
132
138
  backgroundColor: 'blue_dark',
139
+ buttonColor: 'red',
140
+ textColor: 'white',
133
141
  mbshipID: null,
134
142
  otherAmountText: 'will help us fund amazing projects in the UK and around the world.',
135
143
  subtitle: '',
@@ -1,6 +1,6 @@
1
1
  # Donate
2
2
 
3
- ## Form align right, with red backgound on desktop view
3
+ ## Form align right, with red desktop overlay and purple mobile background colour
4
4
 
5
5
  ```js
6
6
  import data from './dev-data/data';
@@ -9,7 +9,8 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
9
9
 
10
10
  <Donate
11
11
  alt="Background image"
12
- backgroundColor="red"
12
+ backgroundColor="deep_violet_dark"
13
+ overlayColor="red"
13
14
  formAlignRight={true}
14
15
  imageLow={desktopPictures.imageLow}
15
16
  images={desktopPictures.images}
@@ -34,6 +35,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
34
35
 
35
36
  <Donate
36
37
  backgroundColor="blue_dark"
38
+ overlayColor="blue_dark"
37
39
  formAlignRight={false}
38
40
  imageLow={desktopPictures.imageLow}
39
41
  images={desktopPictures.images}
@@ -59,6 +61,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
59
61
 
60
62
  <Donate
61
63
  backgroundColor="blue_dark"
64
+ overlayColor="blue_dark"
62
65
  formAlignRight={false}
63
66
  imageLow={desktopPictures.imageLow}
64
67
  images={desktopPictures.images}
@@ -83,6 +86,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
83
86
 
84
87
  <Donate
85
88
  backgroundColor="blue_dark"
89
+ overlayColor="blue_dark"
86
90
  formAlignRight={false}
87
91
  imageLow={desktopPictures.imageLow}
88
92
  images={desktopPictures.images}
@@ -109,6 +113,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
109
113
  <Donate
110
114
  alt="Background image"
111
115
  backgroundColor="transparent"
116
+ overlayColor="transparent"
112
117
  formAlignRight={true}
113
118
  imageLow={desktopPictures.imageLow}
114
119
  images={desktopPictures.images}
@@ -197,12 +202,13 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
197
202
  />;
198
203
  ```
199
204
 
200
- ## Single Giving "No Money Buys", no background image, overriding 'choose amount' text
205
+ ## Single Giving "No Money Buys", no background image, blue background; overriding 'choose amount' text
201
206
 
202
207
  ```js
203
208
  import data from './dev-data/data-single';
204
209
 
205
210
  <Donate
211
+ overlayColor="blue_dark"
206
212
  backgroundColor="blue_dark"
207
213
  formAlignRight={false}
208
214
  data={data}
@@ -217,7 +223,7 @@ import data from './dev-data/data-single';
217
223
  />;
218
224
  ```
219
225
 
220
- ## Forcing mobile layout via isDesktop override; needed to pass parent prop for external media queries
226
+ ## Forcing mobile layout via isDesktop override; needed to pass parent prop for external media queries, red background
221
227
 
222
228
  ```js
223
229
  import data from './dev-data/data';
@@ -227,6 +233,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
227
233
  <Donate
228
234
  alt="Background image"
229
235
  backgroundColor="red"
236
+ overlayColor="red"
230
237
  formAlignRight={true}
231
238
  imageLow={desktopPictures.imageLow}
232
239
  images={desktopPictures.images}
@@ -26,12 +26,13 @@ var Container = _styledComponents.default.div.withConfig({
26
26
  displayName: "Donatestyle__Container",
27
27
  componentId: "sc-8rjm3t-0"
28
28
  })(["position:relative;display:flex;flex-direction:column;justify-content:center;height:auto;background-color:", ";", "{flex-direction:row;align-items:center;justify-content:inherit;background-color:", ";}"], function (_ref) {
29
- var theme = _ref.theme;
30
- return theme.color('blue_dark');
29
+ var theme = _ref.theme,
30
+ backgroundColor = _ref.backgroundColor;
31
+ return theme.color(backgroundColor);
31
32
  }, (0, _size.media)('medium'), function (_ref2) {
32
33
  var theme = _ref2.theme,
33
- backgroundColor = _ref2.backgroundColor;
34
- return theme.color(backgroundColor);
34
+ overlayColor = _ref2.overlayColor;
35
+ return theme.color(overlayColor);
35
36
  });
36
37
 
37
38
  exports.Container = Container;
@@ -171,8 +172,9 @@ var Button = _styledComponents.default.button.withConfig({
171
172
  var theme = _ref14.theme;
172
173
  return theme.fontSize('s');
173
174
  }, function (_ref15) {
174
- var theme = _ref15.theme;
175
- return theme.color('red');
175
+ var theme = _ref15.theme,
176
+ buttonColor = _ref15.buttonColor;
177
+ return theme.color(buttonColor);
176
178
  }, function (_ref16) {
177
179
  var theme = _ref16.theme;
178
180
  return theme.color('coral_dark');
@@ -25,7 +25,7 @@ var _Donate = require("../Donate.style");
25
25
 
26
26
  var _GivingSelector = _interopRequireDefault(require("../GivingSelector/GivingSelector"));
27
27
 
28
- var _excluded = ["data", "donateLink", "otherAmountText", "clientID", "cartID", "mbshipID", "noMoneyBuys", "PopUpText", "chooseAmountText"];
28
+ var _excluded = ["data", "donateLink", "otherAmountText", "clientID", "cartID", "mbshipID", "noMoneyBuys", "PopUpText", "chooseAmountText", "buttonColor"];
29
29
 
30
30
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
31
31
 
@@ -43,6 +43,7 @@ var Signup = function Signup(_ref) {
43
43
  noMoneyBuys = _ref.noMoneyBuys,
44
44
  PopUpText = _ref.PopUpText,
45
45
  chooseAmountText = _ref.chooseAmountText,
46
+ buttonColor = _ref.buttonColor,
46
47
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
47
48
 
48
49
  var _useState = (0, _react.useState)('single'),
@@ -184,11 +185,13 @@ var Signup = function Signup(_ref) {
184
185
  }, "Please enter an amount between \xA31 and \xA325000 and up to 2 decimal places"), noMoneyBuys ? /*#__PURE__*/_react.default.createElement(_Donate.Button, {
185
186
  type: "submit",
186
187
  as: "input",
187
- value: "Donate"
188
+ value: "Donate",
189
+ buttonColor: buttonColor
188
190
  }) : /*#__PURE__*/_react.default.createElement(_Donate.Button, {
189
191
  type: "submit",
190
192
  as: "input",
191
- value: givingType === 'single' ? 'Donate now' : 'Donate monthly'
193
+ value: givingType === 'single' ? 'Donate now' : 'Donate monthly',
194
+ buttonColor: buttonColor
192
195
  }))));
193
196
  };
194
197
 
@@ -500,7 +500,7 @@ exports[`Monthly donation renders correctly 1`] = `
500
500
  -webkit-justify-content: inherit;
501
501
  -ms-flex-pack: inherit;
502
502
  justify-content: inherit;
503
- background-color: #274084;
503
+ background-color: transparent;
504
504
  }
505
505
  }
506
506
 
@@ -1251,7 +1251,7 @@ exports[`Single donation renders correctly 1`] = `
1251
1251
  -webkit-justify-content: inherit;
1252
1252
  -ms-flex-pack: inherit;
1253
1253
  justify-content: inherit;
1254
- background-color: #274084;
1254
+ background-color: transparent;
1255
1255
  }
1256
1256
  }
1257
1257
 
@@ -1845,7 +1845,7 @@ exports[`Single donation with no Money Buys renders correctly 1`] = `
1845
1845
  -webkit-justify-content: inherit;
1846
1846
  -ms-flex-pack: inherit;
1847
1847
  justify-content: inherit;
1848
- background-color: #274084;
1848
+ background-color: transparent;
1849
1849
  }
1850
1850
  }
1851
1851
 
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": "7.4.0",
4
+ "version": "7.5.0",
5
5
  "main": "dist/index.js",
6
6
  "license": "ISC",
7
7
  "jest": {
@@ -18,7 +18,10 @@ const Donate = ({
18
18
  alt,
19
19
  cartID,
20
20
  clientID,
21
+ overlayColor,
21
22
  backgroundColor,
23
+ buttonColor,
24
+ textColor,
22
25
  donateLink,
23
26
  data,
24
27
  title,
@@ -52,7 +55,12 @@ const Donate = ({
52
55
  isDesktop = overrideValue !== null ? overrideValue : isDesktop;
53
56
 
54
57
  return (
55
- <Container backgroundColor={backgroundColor} id={mbshipID} key={overrideValue}>
58
+ <Container
59
+ backgroundColor={backgroundColor}
60
+ overlayColor={overlayColor}
61
+ id={mbshipID}
62
+ key={overrideValue}
63
+ >
56
64
  {!isDesktop && mobileImages ? (
57
65
  <Picture
58
66
  backgroundColor={backgroundColor}
@@ -68,7 +76,7 @@ const Donate = ({
68
76
 
69
77
  {isDesktop && images ? (
70
78
  <BgImage
71
- backgroundColor={backgroundColor}
79
+ backgroundColor={overlayColor}
72
80
  image={image}
73
81
  images={images}
74
82
  imageLow={imageLow}
@@ -87,7 +95,7 @@ const Donate = ({
87
95
  <>
88
96
  <Text
89
97
  tag="h2"
90
- color="white"
98
+ color={textColor}
91
99
  size="big"
92
100
  family="Anton"
93
101
  weight="normal"
@@ -95,7 +103,7 @@ const Donate = ({
95
103
  >
96
104
  {title}
97
105
  </Text>
98
- <Text tag="p" color="white" size="m">
106
+ <Text tag="p" color={textColor} size="m">
99
107
  {subtitle}
100
108
  </Text>
101
109
  </>
@@ -113,6 +121,7 @@ const Donate = ({
113
121
  noMoneyBuys={noMoneyBuys}
114
122
  PopUpText={PopUpText}
115
123
  chooseAmountText={chooseAmountText}
124
+ buttonColor={buttonColor}
116
125
  />
117
126
  </Wrapper>
118
127
  </Container>
@@ -137,6 +146,9 @@ Donate.propTypes = {
137
146
  mobileImages: PropTypes.string,
138
147
  mobileAlt: PropTypes.string,
139
148
  backgroundColor: PropTypes.string,
149
+ overlayColor: PropTypes.string,
150
+ buttonColor: PropTypes.string,
151
+ textColor: PropTypes.string,
140
152
  mbshipID: PropTypes.string,
141
153
  noMoneyBuys: PropTypes.bool,
142
154
  PopUpText: PropTypes.string,
@@ -155,7 +167,10 @@ Donate.defaultProps = {
155
167
  mobileImage: null,
156
168
  mobileImages: null,
157
169
  mobileAlt: '',
170
+ overlayColor: 'transparent',
158
171
  backgroundColor: 'blue_dark',
172
+ buttonColor: 'red',
173
+ textColor: 'white',
159
174
  mbshipID: null,
160
175
  otherAmountText:
161
176
  'will help us fund amazing projects in the UK and around the world.',
@@ -1,6 +1,6 @@
1
1
  # Donate
2
2
 
3
- ## Form align right, with red backgound on desktop view
3
+ ## Form align right, with red desktop overlay and purple mobile background colour
4
4
 
5
5
  ```js
6
6
  import data from './dev-data/data';
@@ -9,7 +9,8 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
9
9
 
10
10
  <Donate
11
11
  alt="Background image"
12
- backgroundColor="red"
12
+ backgroundColor="deep_violet_dark"
13
+ overlayColor="red"
13
14
  formAlignRight={true}
14
15
  imageLow={desktopPictures.imageLow}
15
16
  images={desktopPictures.images}
@@ -34,6 +35,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
34
35
 
35
36
  <Donate
36
37
  backgroundColor="blue_dark"
38
+ overlayColor="blue_dark"
37
39
  formAlignRight={false}
38
40
  imageLow={desktopPictures.imageLow}
39
41
  images={desktopPictures.images}
@@ -59,6 +61,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
59
61
 
60
62
  <Donate
61
63
  backgroundColor="blue_dark"
64
+ overlayColor="blue_dark"
62
65
  formAlignRight={false}
63
66
  imageLow={desktopPictures.imageLow}
64
67
  images={desktopPictures.images}
@@ -83,6 +86,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
83
86
 
84
87
  <Donate
85
88
  backgroundColor="blue_dark"
89
+ overlayColor="blue_dark"
86
90
  formAlignRight={false}
87
91
  imageLow={desktopPictures.imageLow}
88
92
  images={desktopPictures.images}
@@ -109,6 +113,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
109
113
  <Donate
110
114
  alt="Background image"
111
115
  backgroundColor="transparent"
116
+ overlayColor="transparent"
112
117
  formAlignRight={true}
113
118
  imageLow={desktopPictures.imageLow}
114
119
  images={desktopPictures.images}
@@ -197,12 +202,13 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
197
202
  />;
198
203
  ```
199
204
 
200
- ## Single Giving "No Money Buys", no background image, overriding 'choose amount' text
205
+ ## Single Giving "No Money Buys", no background image, blue background; overriding 'choose amount' text
201
206
 
202
207
  ```js
203
208
  import data from './dev-data/data-single';
204
209
 
205
210
  <Donate
211
+ overlayColor="blue_dark"
206
212
  backgroundColor="blue_dark"
207
213
  formAlignRight={false}
208
214
  data={data}
@@ -217,7 +223,7 @@ import data from './dev-data/data-single';
217
223
  />;
218
224
  ```
219
225
 
220
- ## Forcing mobile layout via isDesktop override; needed to pass parent prop for external media queries
226
+ ## Forcing mobile layout via isDesktop override; needed to pass parent prop for external media queries, red background
221
227
 
222
228
  ```js
223
229
  import data from './dev-data/data';
@@ -227,6 +233,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
227
233
  <Donate
228
234
  alt="Background image"
229
235
  backgroundColor="red"
236
+ overlayColor="red"
230
237
  formAlignRight={true}
231
238
  imageLow={desktopPictures.imageLow}
232
239
  images={desktopPictures.images}
@@ -14,12 +14,12 @@ const Container = styled.div`
14
14
  flex-direction: column;
15
15
  justify-content: center;
16
16
  height: auto;
17
- background-color: ${({ theme }) => theme.color('blue_dark')};
17
+ background-color: ${({ theme, backgroundColor }) => theme.color(backgroundColor)};
18
18
  ${media('medium')} {
19
19
  flex-direction: row;
20
20
  align-items: center;
21
21
  justify-content: inherit;
22
- background-color: ${({ theme, backgroundColor }) => theme.color(backgroundColor)};
22
+ background-color: ${({ theme, overlayColor }) => theme.color(overlayColor)};
23
23
  }
24
24
  `;
25
25
 
@@ -215,7 +215,7 @@ const Button = styled.button`
215
215
  font-weight: bold;
216
216
  cursor: pointer;
217
217
  min-height: 48px;
218
- background: ${({ theme }) => theme.color('red')};
218
+ background: ${({ theme, buttonColor }) => theme.color(buttonColor)};
219
219
  text-decoration: none;
220
220
  border-radius: 2rem;
221
221
  border: none;
@@ -33,6 +33,7 @@ const Signup = ({
33
33
  noMoneyBuys,
34
34
  PopUpText,
35
35
  chooseAmountText,
36
+ buttonColor,
36
37
  ...rest
37
38
  }) => {
38
39
  const [givingType, setGivingType] = useState('single');
@@ -211,12 +212,13 @@ const Signup = ({
211
212
  )}
212
213
 
213
214
  {noMoneyBuys ? (
214
- <Button type="submit" as="input" value="Donate" />
215
+ <Button type="submit" as="input" value="Donate" buttonColor={buttonColor} />
215
216
  ) : (
216
217
  <Button
217
218
  type="submit"
218
219
  as="input"
219
220
  value={givingType === 'single' ? 'Donate now' : 'Donate monthly'}
221
+ buttonColor={buttonColor}
220
222
  />
221
223
  )}
222
224
 
@@ -235,7 +237,8 @@ Signup.propTypes = {
235
237
  noMoneyBuys: PropTypes.bool,
236
238
  data: PropTypes.objectOf(PropTypes.shape),
237
239
  PopUpText: PropTypes.string.isRequired,
238
- chooseAmountText: PropTypes.string.isRequired
240
+ chooseAmountText: PropTypes.string.isRequired,
241
+ buttonColor: PropTypes.string.isRequired
239
242
  };
240
243
 
241
244
  Signup.defaultProps = {
@@ -500,7 +500,7 @@ exports[`Monthly donation renders correctly 1`] = `
500
500
  -webkit-justify-content: inherit;
501
501
  -ms-flex-pack: inherit;
502
502
  justify-content: inherit;
503
- background-color: #274084;
503
+ background-color: transparent;
504
504
  }
505
505
  }
506
506
 
@@ -1251,7 +1251,7 @@ exports[`Single donation renders correctly 1`] = `
1251
1251
  -webkit-justify-content: inherit;
1252
1252
  -ms-flex-pack: inherit;
1253
1253
  justify-content: inherit;
1254
- background-color: #274084;
1254
+ background-color: transparent;
1255
1255
  }
1256
1256
  }
1257
1257
 
@@ -1845,7 +1845,7 @@ exports[`Single donation with no Money Buys renders correctly 1`] = `
1845
1845
  -webkit-justify-content: inherit;
1846
1846
  -ms-flex-pack: inherit;
1847
1847
  justify-content: inherit;
1848
- background-color: #274084;
1848
+ background-color: transparent;
1849
1849
  }
1850
1850
  }
1851
1851