@comicrelief/component-library 6.3.0 → 6.4.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.
@@ -39,7 +39,8 @@ var Donate = function Donate(_ref) {
39
39
  mobileAlt = _ref.mobileAlt,
40
40
  mbshipID = _ref.mbshipID,
41
41
  noMoneyBuys = _ref.noMoneyBuys,
42
- PopUpText = _ref.PopUpText;
42
+ PopUpText = _ref.PopUpText,
43
+ chooseAmountText = _ref.chooseAmountText;
43
44
  var isDesktop = (0, _reactResponsive.useMediaQuery)({
44
45
  query: "(min-width: ".concat(_size.screen.medium, ")")
45
46
  });
@@ -88,7 +89,8 @@ var Donate = function Donate(_ref) {
88
89
  mbshipID: mbshipID,
89
90
  donateLink: donateLink,
90
91
  noMoneyBuys: noMoneyBuys,
91
- PopUpText: PopUpText
92
+ PopUpText: PopUpText,
93
+ chooseAmountText: chooseAmountText
92
94
  })));
93
95
  };
94
96
 
@@ -108,7 +110,8 @@ Donate.defaultProps = {
108
110
  otherDescription: 'will help us fund amazing projects in the UK and around the world.',
109
111
  subtitle: '',
110
112
  noMoneyBuys: false,
111
- PopUpText: "Will you become one of our valued monthly supporters by converting your single donation into a smaller, monthly donation? By giving monthly, you'll help us deliver long-term impact."
113
+ PopUpText: "Will you become one of our valued monthly supporters by converting your single donation into a smaller, monthly donation? By giving monthly, you'll help us deliver long-term impact.",
114
+ chooseAmountText: ''
112
115
  };
113
116
  var _default = Donate;
114
117
  exports.default = _default;
@@ -204,7 +204,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
204
204
  />;
205
205
  ```
206
206
 
207
- ## Single Giving "No Money Buys", no background image
207
+ ## Single Giving "No Money Buys", no background image, overriding 'choose amount' text
208
208
 
209
209
  ```js
210
210
  import data from './dev-data/data-single';
@@ -221,5 +221,6 @@ import data from './dev-data/data-single';
221
221
  noMoneyBuys
222
222
  subtitle=""
223
223
  otherDescription="will help us fund amazing projects in the UK and around the world."
224
+ chooseAmountText="Overridden via the 'choose amount text' props"
224
225
  />;
225
226
  ```
@@ -65,7 +65,8 @@ it('Single donation with no Money Buys renders correctly', function () {
65
65
  title: "Donate Now",
66
66
  noMoneyBuys: true,
67
67
  subtitle: "Please help us fund life-changing projects in the UK and around the world.",
68
- otherDescription: "will help us fund amazing projects in the UK and around the world."
68
+ otherDescription: "will help us fund amazing projects in the UK and around the world.",
69
+ chooseAmountText: "Overridden via the 'choose amount text' props"
69
70
  })).toJSON();
70
71
  expect(tree).toMatchSnapshot();
71
72
  });
@@ -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", "otherDescription", "clientID", "cartID", "mbshipID", "noMoneyBuys", "PopUpText"];
28
+ var _excluded = ["data", "donateLink", "otherDescription", "clientID", "cartID", "mbshipID", "noMoneyBuys", "PopUpText", "chooseAmountText"];
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
 
@@ -42,6 +42,7 @@ var Signup = function Signup(_ref) {
42
42
  mbshipID = _ref.mbshipID,
43
43
  noMoneyBuys = _ref.noMoneyBuys,
44
44
  PopUpText = _ref.PopUpText,
45
+ chooseAmountText = _ref.chooseAmountText,
45
46
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
46
47
 
47
48
  var _useState = (0, _react.useState)('single'),
@@ -121,7 +122,7 @@ var Signup = function Signup(_ref) {
121
122
  tag: "span",
122
123
  size: "l",
123
124
  weight: "bold"
124
- }, "".concat(noMoneyBuys ? 'Enter' : 'Choose', " an amount to give"))), !noMoneyBuys && /*#__PURE__*/_react.default.createElement(_Donate.MoneyBuys, null, givingData.moneybuys.map(function (_ref2, index) {
125
+ }, chooseAmountText || "".concat(noMoneyBuys ? 'Enter' : 'Choose', " an amount to give"))), !noMoneyBuys && /*#__PURE__*/_react.default.createElement(_Donate.MoneyBuys, null, givingData.moneybuys.map(function (_ref2, index) {
125
126
  var value = _ref2.value;
126
127
  return /*#__PURE__*/_react.default.createElement(_MoneyBox.default, {
127
128
  isSelected: amountDonate === value,
@@ -2042,7 +2042,7 @@ exports[`Single donation with no Money Buys renders correctly 1`] = `
2042
2042
  color="inherit"
2043
2043
  size="l"
2044
2044
  >
2045
- Enter an amount to give
2045
+ Overridden via the 'choose amount text' props
2046
2046
  </span>
2047
2047
  </legend>
2048
2048
  <div
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": "6.3.0",
4
+ "version": "6.4.0",
5
5
  "main": "dist/index.js",
6
6
  "license": "ISC",
7
7
  "jest": {
@@ -34,7 +34,8 @@ const Donate = ({
34
34
  mobileAlt,
35
35
  mbshipID,
36
36
  noMoneyBuys,
37
- PopUpText
37
+ PopUpText,
38
+ chooseAmountText
38
39
  }) => {
39
40
  const isDesktop = useMediaQuery({ query: `(min-width: ${screen.medium})` });
40
41
 
@@ -99,6 +100,7 @@ const Donate = ({
99
100
  donateLink={donateLink}
100
101
  noMoneyBuys={noMoneyBuys}
101
102
  PopUpText={PopUpText}
103
+ chooseAmountText={chooseAmountText}
102
104
  />
103
105
  </Wrapper>
104
106
  </Container>
@@ -125,7 +127,8 @@ Donate.propTypes = {
125
127
  backgroundColor: PropTypes.string,
126
128
  mbshipID: PropTypes.string,
127
129
  noMoneyBuys: PropTypes.bool,
128
- PopUpText: PropTypes.string
130
+ PopUpText: PropTypes.string,
131
+ chooseAmountText: PropTypes.string
129
132
  };
130
133
 
131
134
  Donate.defaultProps = {
@@ -145,7 +148,8 @@ Donate.defaultProps = {
145
148
  'will help us fund amazing projects in the UK and around the world.',
146
149
  subtitle: '',
147
150
  noMoneyBuys: false,
148
- PopUpText: "Will you become one of our valued monthly supporters by converting your single donation into a smaller, monthly donation? By giving monthly, you'll help us deliver long-term impact."
151
+ PopUpText: "Will you become one of our valued monthly supporters by converting your single donation into a smaller, monthly donation? By giving monthly, you'll help us deliver long-term impact.",
152
+ chooseAmountText: ''
149
153
  };
150
154
 
151
155
  export default Donate;
@@ -204,7 +204,7 @@ const desktopPictures = require('../../../styleguide/data/data').defaultData;
204
204
  />;
205
205
  ```
206
206
 
207
- ## Single Giving "No Money Buys", no background image
207
+ ## Single Giving "No Money Buys", no background image, overriding 'choose amount' text
208
208
 
209
209
  ```js
210
210
  import data from './dev-data/data-single';
@@ -221,5 +221,6 @@ import data from './dev-data/data-single';
221
221
  noMoneyBuys
222
222
  subtitle=""
223
223
  otherDescription="will help us fund amazing projects in the UK and around the world."
224
+ chooseAmountText="Overridden via the 'choose amount text' props"
224
225
  />;
225
226
  ```
@@ -66,6 +66,7 @@ it('Single donation with no Money Buys renders correctly', () => {
66
66
  noMoneyBuys
67
67
  subtitle="Please help us fund life-changing projects in the UK and around the world."
68
68
  otherDescription="will help us fund amazing projects in the UK and around the world."
69
+ chooseAmountText="Overridden via the 'choose amount text' props"
69
70
  />
70
71
  ).toJSON();
71
72
 
@@ -32,6 +32,7 @@ const Signup = ({
32
32
  mbshipID,
33
33
  noMoneyBuys,
34
34
  PopUpText,
35
+ chooseAmountText,
35
36
  ...rest
36
37
  }) => {
37
38
  const [givingType, setGivingType] = useState('single');
@@ -142,7 +143,7 @@ const Signup = ({
142
143
  <OuterFieldset>
143
144
  <Legend>
144
145
  <Text tag="span" size="l" weight="bold">
145
- {`${noMoneyBuys ? 'Enter' : 'Choose'} an amount to give`}
146
+ {chooseAmountText || `${noMoneyBuys ? 'Enter' : 'Choose'} an amount to give`}
146
147
  </Text>
147
148
  </Legend>
148
149
  {!noMoneyBuys && (
@@ -220,7 +221,8 @@ Signup.propTypes = {
220
221
  mbshipID: PropTypes.string.isRequired,
221
222
  noMoneyBuys: PropTypes.bool,
222
223
  data: PropTypes.objectOf(PropTypes.shape),
223
- PopUpText: PropTypes.string.isRequired
224
+ PopUpText: PropTypes.string.isRequired,
225
+ chooseAmountText: PropTypes.string.isRequired
224
226
  };
225
227
 
226
228
  Signup.defaultProps = {
@@ -2042,7 +2042,7 @@ exports[`Single donation with no Money Buys renders correctly 1`] = `
2042
2042
  color="inherit"
2043
2043
  size="l"
2044
2044
  >
2045
- Enter an amount to give
2045
+ Overridden via the 'choose amount text' props
2046
2046
  </span>
2047
2047
  </legend>
2048
2048
  <div