@comicrelief/component-library 6.6.2 → 6.6.3

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.
@@ -42,10 +42,14 @@ var Donate = function Donate(_ref) {
42
42
  mbshipID = _ref.mbshipID,
43
43
  noMoneyBuys = _ref.noMoneyBuys,
44
44
  PopUpText = _ref.PopUpText,
45
- chooseAmountText = _ref.chooseAmountText;
45
+ chooseAmountText = _ref.chooseAmountText,
46
+ isDesktopOverride = _ref.isDesktopOverride;
47
+ // Can't assign this conditionally due to Hook rules..
46
48
  var isDesktop = (0, _reactResponsive.useMediaQuery)({
47
49
  query: "(min-width: ".concat(_size.screen.medium, ")")
48
- });
50
+ }); // ... but we can just do this, allowing the parent to control that if IT re-renders
51
+
52
+ if (isDesktopOverride !== null) isDesktop = isDesktopOverride;
49
53
  return /*#__PURE__*/_react.default.createElement(_Donate.Container, {
50
54
  backgroundColor: backgroundColor,
51
55
  id: mbshipID
@@ -114,7 +118,8 @@ Donate.defaultProps = {
114
118
  subtitle: '',
115
119
  noMoneyBuys: false,
116
120
  PopUpText: 'Help us deliver long-term impact by converting your single donation into a monthly gift.',
117
- chooseAmountText: ''
121
+ chooseAmountText: '',
122
+ isDesktopOverride: null
118
123
  };
119
124
  var _default = Donate;
120
125
  exports.default = _default;
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.6.2",
4
+ "version": "6.6.3",
5
5
  "main": "dist/index.js",
6
6
  "license": "ISC",
7
7
  "jest": {
@@ -35,9 +35,14 @@ const Donate = ({
35
35
  mbshipID,
36
36
  noMoneyBuys,
37
37
  PopUpText,
38
- chooseAmountText
38
+ chooseAmountText,
39
+ isDesktopOverride
39
40
  }) => {
40
- const isDesktop = useMediaQuery({ query: `(min-width: ${screen.medium})` });
41
+ // Can't assign this conditionally due to Hook rules..
42
+ let isDesktop = useMediaQuery({ query: `(min-width: ${screen.medium})` });
43
+
44
+ // ... but we can just do this, allowing the parent to control that if IT re-renders
45
+ if (isDesktopOverride !== null) isDesktop = isDesktopOverride;
41
46
 
42
47
  return (
43
48
  <Container backgroundColor={backgroundColor} id={mbshipID}>
@@ -128,7 +133,8 @@ Donate.propTypes = {
128
133
  mbshipID: PropTypes.string,
129
134
  noMoneyBuys: PropTypes.bool,
130
135
  PopUpText: PropTypes.string,
131
- chooseAmountText: PropTypes.string
136
+ chooseAmountText: PropTypes.string,
137
+ isDesktopOverride: PropTypes.bool
132
138
  };
133
139
 
134
140
  Donate.defaultProps = {
@@ -149,7 +155,8 @@ Donate.defaultProps = {
149
155
  subtitle: '',
150
156
  noMoneyBuys: false,
151
157
  PopUpText: 'Help us deliver long-term impact by converting your single donation into a monthly gift.',
152
- chooseAmountText: ''
158
+ chooseAmountText: '',
159
+ isDesktopOverride: null
153
160
  };
154
161
 
155
162
  export default Donate;
@@ -123,7 +123,7 @@ const GivingSelector = ({ givingType, changeGivingType, setPopOpen }) => (
123
123
  GivingSelector.propTypes = {
124
124
  givingType: PropTypes.string.isRequired,
125
125
  changeGivingType: PropTypes.func.isRequired,
126
- setPopOpen: PropTypes.bool.isRequired
126
+ setPopOpen: PropTypes.func.isRequired
127
127
  };
128
128
 
129
129
  export default GivingSelector;