@comicrelief/component-library 6.2.0 → 6.3.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.
Files changed (63) hide show
  1. package/dist/components/Atoms/Picture/Picture.md +6 -9
  2. package/dist/components/Atoms/Picture/Picture.test.js +5 -5
  3. package/dist/components/Molecules/ArticleTeaser/ArticleTeaser.md +6 -8
  4. package/dist/components/Molecules/ArticleTeaser/ArticleTeaser.test.js +3 -3
  5. package/dist/components/Molecules/Box/Box.md +5 -7
  6. package/dist/components/Molecules/Box/Box.test.js +3 -3
  7. package/dist/components/Molecules/Card/Card.md +5 -7
  8. package/dist/components/Molecules/Card/Card.test.js +5 -5
  9. package/dist/components/Molecules/CardDs/CardDs.md +8 -12
  10. package/dist/components/Molecules/CardDs/CardDs.test.js +3 -3
  11. package/dist/components/Molecules/PartnerLink/PartnerLink.md +2 -3
  12. package/dist/components/Molecules/PartnerLink/PartnerLink.test.js +3 -3
  13. package/dist/components/Molecules/Promo/Promo.md +13 -14
  14. package/dist/components/Molecules/Promo/Promo.test.js +5 -5
  15. package/dist/components/Molecules/SearchResult/SearchResult.md +12 -16
  16. package/dist/components/Molecules/SearchResult/SearchResult.test.js +5 -5
  17. package/dist/components/Molecules/SingleMessage/SingleMessage.md +37 -48
  18. package/dist/components/Molecules/SingleMessage/SingleMessage.test.js +15 -15
  19. package/dist/components/Molecules/SingleMessageDS/SingleMessageDs.md +15 -20
  20. package/dist/components/Molecules/SingleMessageDS/SingleMessageDs.test.js +3 -3
  21. package/dist/components/Organisms/Donate/Donate.js +35 -7
  22. package/dist/components/Organisms/Donate/Donate.md +148 -14
  23. package/dist/components/Organisms/Donate/Donate.style.js +61 -45
  24. package/dist/components/Organisms/Donate/Donate.test.js +7 -7
  25. package/dist/components/Organisms/Donate/Form/Form.js +6 -1
  26. package/dist/components/Organisms/Donate/Form/PopUpComponent.js +74 -0
  27. package/dist/components/Organisms/Donate/__snapshots__/Donate.test.js.snap +344 -388
  28. package/dist/components/Organisms/Donate/assets/close.svg +3 -0
  29. package/dist/components/Organisms/Membership/Membership.md +6 -6
  30. package/dist/components/Organisms/Membership/Membership.test.js +5 -5
  31. package/dist/styleguide/data/data.js +9 -3
  32. package/package.json +2 -1
  33. package/src/components/Atoms/Picture/Picture.md +6 -9
  34. package/src/components/Atoms/Picture/Picture.test.js +4 -5
  35. package/src/components/Molecules/ArticleTeaser/ArticleTeaser.md +6 -8
  36. package/src/components/Molecules/ArticleTeaser/ArticleTeaser.test.js +3 -4
  37. package/src/components/Molecules/Box/Box.md +5 -7
  38. package/src/components/Molecules/Box/Box.test.js +2 -3
  39. package/src/components/Molecules/Card/Card.md +5 -7
  40. package/src/components/Molecules/Card/Card.test.js +3 -4
  41. package/src/components/Molecules/CardDs/CardDs.md +8 -12
  42. package/src/components/Molecules/CardDs/CardDs.test.js +3 -4
  43. package/src/components/Molecules/PartnerLink/PartnerLink.md +2 -3
  44. package/src/components/Molecules/PartnerLink/PartnerLink.test.js +2 -3
  45. package/src/components/Molecules/Promo/Promo.md +13 -14
  46. package/src/components/Molecules/Promo/Promo.test.js +5 -6
  47. package/src/components/Molecules/SearchResult/SearchResult.md +12 -16
  48. package/src/components/Molecules/SearchResult/SearchResult.test.js +5 -5
  49. package/src/components/Molecules/SingleMessage/SingleMessage.md +37 -48
  50. package/src/components/Molecules/SingleMessage/SingleMessage.test.js +15 -16
  51. package/src/components/Molecules/SingleMessageDS/SingleMessageDs.md +15 -20
  52. package/src/components/Molecules/SingleMessageDS/SingleMessageDs.test.js +3 -4
  53. package/src/components/Organisms/Donate/Donate.js +91 -50
  54. package/src/components/Organisms/Donate/Donate.md +148 -14
  55. package/src/components/Organisms/Donate/Donate.style.js +16 -1
  56. package/src/components/Organisms/Donate/Donate.test.js +7 -7
  57. package/src/components/Organisms/Donate/Form/Form.js +9 -1
  58. package/src/components/Organisms/Donate/Form/PopUpComponent.js +63 -0
  59. package/src/components/Organisms/Donate/__snapshots__/Donate.test.js.snap +344 -388
  60. package/src/components/Organisms/Donate/assets/close.svg +3 -0
  61. package/src/components/Organisms/Membership/Membership.md +6 -6
  62. package/src/components/Organisms/Membership/Membership.test.js +9 -14
  63. package/src/styleguide/data/data.js +12 -1
@@ -1,12 +1,11 @@
1
1
  ### Minimalist
2
2
 
3
3
  ```js
4
- const data = require('../../../styleguide/data/data').default;
5
-
4
+ const defaultData = require('../../../styleguide/data/data').defaultData;
6
5
  <SearchResult
7
6
  href="/test"
8
- imageLow={data.imageLow}
9
- images={data.images}
7
+ imageLow={defaultData.imageLow}
8
+ images={defaultData.images}
10
9
  title="News article"
11
10
  alt="Image's description"
12
11
  />;
@@ -15,12 +14,11 @@ const data = require('../../../styleguide/data/data').default;
15
14
  ### With copy
16
15
 
17
16
  ```js
18
- const data = require('../../../styleguide/data/data').default;
19
-
17
+ const defaultData = require('../../../styleguide/data/data').defaultData;
20
18
  <SearchResult
21
19
  href="/test"
22
- imageLow={data.imageLow}
23
- images={data.images}
20
+ imageLow={defaultData.imageLow}
21
+ images={defaultData.images}
24
22
  title="News article"
25
23
  copy="News article copy"
26
24
  alt="Image's description"
@@ -30,12 +28,11 @@ const data = require('../../../styleguide/data/data').default;
30
28
  ### With date
31
29
 
32
30
  ```js
33
- const data = require('../../../styleguide/data/data').default;
34
-
31
+ const defaultData = require('../../../styleguide/data/data').defaultData;
35
32
  <SearchResult
36
33
  href="/test"
37
- imageLow={data.imageLow}
38
- images={data.images}
34
+ imageLow={defaultData.imageLow}
35
+ images={defaultData.images}
39
36
  date="01 July 2019"
40
37
  title="News article"
41
38
  alt="Image's description"
@@ -45,12 +42,11 @@ const data = require('../../../styleguide/data/data').default;
45
42
  ### With date and type
46
43
 
47
44
  ```js
48
- const data = require('../../../styleguide/data/data').default;
49
-
45
+ const defaultData = require('../../../styleguide/data/data').defaultData;
50
46
  <SearchResult
51
47
  href="/test"
52
- imageLow={data.imageLow}
53
- images={data.images}
48
+ imageLow={defaultData.imageLow}
49
+ images={defaultData.images}
54
50
  date="01 July 2019"
55
51
  type="article"
56
52
  title="News article"
@@ -2,13 +2,13 @@ import React from 'react';
2
2
  import 'jest-styled-components';
3
3
  import renderWithTheme from '../../../hoc/shallowWithTheme';
4
4
  import SearchResult from './SearchResult';
5
- import data from '../../../styleguide/data/data';
5
+ import { defaultData } from '../../../styleguide/data/data';
6
6
 
7
7
  it('renders correctly in minimalist form', () => {
8
8
  const tree = renderWithTheme(
9
9
  <SearchResult
10
10
  href="/test"
11
- image={data.image}
11
+ image={defaultData.image}
12
12
  title="News article"
13
13
  alt="Image's description"
14
14
  />
@@ -21,7 +21,7 @@ it('renders correctly with copy', () => {
21
21
  const tree = renderWithTheme(
22
22
  <SearchResult
23
23
  href="/test"
24
- image={data.image}
24
+ image={defaultData.image}
25
25
  title="News article"
26
26
  copy="News article copy"
27
27
  alt="Image's description"
@@ -35,7 +35,7 @@ it('renders correctly with date', () => {
35
35
  const tree = renderWithTheme(
36
36
  <SearchResult
37
37
  href="/test"
38
- image={data.image}
38
+ image={defaultData.image}
39
39
  date="01 July 2019"
40
40
  title="News article"
41
41
  alt="Image's description"
@@ -49,7 +49,7 @@ it('renders correctly with date and type', () => {
49
49
  const tree = renderWithTheme(
50
50
  <SearchResult
51
51
  href="/test"
52
- image={data.image}
52
+ image={defaultData.image}
53
53
  date="01 July 2019"
54
54
  type="article"
55
55
  title="News article"
@@ -1,14 +1,13 @@
1
1
  Single Message
2
2
 
3
3
  ```js
4
- const data = require('../../../styleguide/data/data').default;
5
- import Text from '../../Atoms/Text/Text';
4
+ const defaultData = require('../../../styleguide/data/data').defaultData;import Text from '../../Atoms/Text/Text';
6
5
  import Link from '../../Atoms/Link/Link';
7
6
 
8
7
  <SingleMessage
9
8
  backgroundColor="purple_dark"
10
- imageSet={data.images}
11
- image={data.image}
9
+ imageSet={defaultData.images}
10
+ image={defaultData.image}
12
11
  imageAltText=""
13
12
  copyFirst={false}
14
13
  >
@@ -29,14 +28,13 @@ import Link from '../../Atoms/Link/Link';
29
28
  Single Message fullImage
30
29
 
31
30
  ```js
32
- const data = require('../../../styleguide/data/data').default;
33
- import Text from '../../Atoms/Text/Text';
31
+ const defaultData = require('../../../styleguide/data/data').defaultData;import Text from '../../Atoms/Text/Text';
34
32
  import Link from '../../Atoms/Link/Link';
35
33
 
36
34
  <SingleMessage
37
35
  backgroundColor="purple_dark"
38
- imageSet={data.images}
39
- image={data.image}
36
+ imageSet={defaultData.images}
37
+ image={defaultData.image}
40
38
  imageAltText=""
41
39
  copyFirst={false}
42
40
  fullImage={true}
@@ -59,14 +57,13 @@ import Link from '../../Atoms/Link/Link';
59
57
  Single Message fullImage no copy
60
58
 
61
59
  ```js
62
- const data = require('../../../styleguide/data/data').default;
63
- import Text from '../../Atoms/Text/Text';
60
+ const defaultData = require('../../../styleguide/data/data').defaultData;import Text from '../../Atoms/Text/Text';
64
61
  import Link from '../../Atoms/Link/Link';
65
62
 
66
63
  <SingleMessage
67
64
  backgroundColor="purple_dark"
68
- imageSet={data.images}
69
- image={data.image}
65
+ imageSet={defaultData.images}
66
+ image={defaultData.image}
70
67
  imageAltText=""
71
68
  copyFirst={false}
72
69
  fullImage={true}
@@ -91,13 +88,12 @@ Single Message vertical height 100%
91
88
 
92
89
  ```js
93
90
  import Text from '../../Atoms/Text/Text';
94
- const data = require('../../../styleguide/data/data').default;
95
-
91
+ const defaultData = require('../../../styleguide/data/data').defaultData;
96
92
  <SingleMessage
97
93
  backgroundColor="purple_dark"
98
- imageLow={data.imageLow}
99
- imageSet={data.images}
100
- image={data.image}
94
+ imageLow={defaultData.imageLow}
95
+ imageSet={defaultData.images}
96
+ image={defaultData.image}
101
97
  imageAltText=""
102
98
  vhFull
103
99
  >
@@ -112,16 +108,15 @@ Single Message double image
112
108
 
113
109
  ```js
114
110
  import Text from '../../Atoms/Text/Text';
115
- const data = require('../../../styleguide/data/data').default;
116
-
111
+ const defaultData = require('../../../styleguide/data/data').defaultData;
117
112
  <SingleMessage
118
113
  backgroundColor="yellow"
119
- imageLow={data.imageLow}
120
- imageSet={data.images}
121
- image={data.image}
114
+ imageLow={defaultData.imageLow}
115
+ imageSet={defaultData.images}
116
+ image={defaultData.image}
122
117
  imageAltText=""
123
- imageSet2={data.images}
124
- image2={data.image}
118
+ imageSet2={defaultData.images}
119
+ image2={defaultData.image}
125
120
  imageAltText2=""
126
121
  >
127
122
  <Text tag="p" color="black" size="xxl">
@@ -135,12 +130,11 @@ Single Message with 16:9 video
135
130
 
136
131
  ```js
137
132
  import Text from '../../Atoms/Text/Text';
138
- const data = require('../../../styleguide/data/data').default;
139
-
133
+ const defaultData = require('../../../styleguide/data/data').defaultData;
140
134
  <SingleMessage
141
135
  backgroundColor="purple"
142
- imageSet={data.images}
143
- image={data.image}
136
+ imageSet={defaultData.images}
137
+ image={defaultData.image}
144
138
  imageAltText=""
145
139
  copyFirst={true}
146
140
  videoID="WUgvvPRH7Oc"
@@ -154,12 +148,11 @@ const data = require('../../../styleguide/data/data').default;
154
148
 
155
149
  ```js
156
150
  import Text from '../../Atoms/Text/Text';
157
- const data = require('../../../styleguide/data/data').default;
158
-
151
+ const defaultData = require('../../../styleguide/data/data').defaultData;
159
152
  <SingleMessage
160
153
  backgroundColor="purple"
161
- imageSet={data.images}
162
- image={data.image}
154
+ imageSet={defaultData.images}
155
+ image={defaultData.image}
163
156
  imageAltText=""
164
157
  copyFirst={false}
165
158
  videoID="WUgvvPRH7Oc"
@@ -175,12 +168,11 @@ Single Message with portrait video
175
168
 
176
169
  ```js
177
170
  import Text from '../../Atoms/Text/Text';
178
- const data = require('../../../styleguide/data/data').default;
179
-
171
+ const defaultData = require('../../../styleguide/data/data').defaultData;
180
172
  <SingleMessage
181
173
  backgroundColor="purple"
182
- imageSet={data.images}
183
- image={data.image}
174
+ imageSet={defaultData.images}
175
+ image={defaultData.image}
184
176
  imageAltText=""
185
177
  copyFirst={true}
186
178
  videoID="FoMlSB6ftQg"
@@ -195,12 +187,11 @@ Single Message with portrait video, 100VH
195
187
 
196
188
  ```js
197
189
  import Text from '../../Atoms/Text/Text';
198
- const data = require('../../../styleguide/data/data').default;
199
-
190
+ const defaultData = require('../../../styleguide/data/data').defaultData;
200
191
  <SingleMessage
201
192
  backgroundColor="purple"
202
- imageSet={data.images}
203
- image={data.image}
193
+ imageSet={defaultData.images}
194
+ image={defaultData.image}
204
195
  imageAltText=""
205
196
  copyFirst={true}
206
197
  videoID="fwCQRMlKBnA"
@@ -216,12 +207,11 @@ Single Message with landscape video, 100VH, fullwidth image
216
207
 
217
208
  ```js
218
209
  import Text from '../../Atoms/Text/Text';
219
- const data = require('../../../styleguide/data/data').default;
220
-
210
+ const defaultData = require('../../../styleguide/data/data').defaultData;
221
211
  <SingleMessage
222
212
  backgroundColor="purple"
223
- imageSet={data.images}
224
- image={data.image}
213
+ imageSet={defaultData.images}
214
+ image={defaultData.image}
225
215
  imageAltText=""
226
216
  copyFirst={true}
227
217
  videoID="WUgvvPRH7Oc"
@@ -239,12 +229,11 @@ Single Message with landscape video, 50VH, fullwidth image
239
229
 
240
230
  ```js
241
231
  import Text from '../../Atoms/Text/Text';
242
- const data = require('../../../styleguide/data/data').default;
243
-
232
+ const defaultData = require('../../../styleguide/data/data').defaultData;
244
233
  <SingleMessage
245
234
  backgroundColor="purple"
246
- imageSet={data.images}
247
- image={data.image}
235
+ imageSet={defaultData.images}
236
+ image={defaultData.image}
248
237
  imageAltText=""
249
238
  copyFirst={true}
250
239
  videoID="WUgvvPRH7Oc"
@@ -2,16 +2,15 @@ import React from 'react';
2
2
  import 'jest-styled-components';
3
3
  import renderWithTheme from '../../../hoc/shallowWithTheme';
4
4
  import SingleMessage from './SingleMessage';
5
- import data from '../../../styleguide/data/data';
6
- import Text from '../../Atoms/Text/Text';
5
+ import { defaultData } from '../../../styleguide/data/data';import Text from '../../Atoms/Text/Text';
7
6
  import Link from '../../Atoms/Link/Link';
8
7
 
9
8
  it('renders Single Message with Image correctly', () => {
10
9
  const tree = renderWithTheme(
11
10
  <SingleMessage
12
11
  backgroundColor="purple"
13
- imageSet={data.images}
14
- image={data.image}
12
+ imageSet={defaultData.images}
13
+ image={defaultData.image}
15
14
  imageAltText=""
16
15
  copyFirst={false}
17
16
  >
@@ -47,8 +46,8 @@ it('renders Single Message with full width correctly', () => {
47
46
  const tree = renderWithTheme(
48
47
  <SingleMessage
49
48
  backgroundColor="purple"
50
- imageSet={data.images}
51
- image={data.image}
49
+ imageSet={defaultData.images}
50
+ image={defaultData.image}
52
51
  imageAltText=""
53
52
  copyFirst={false}
54
53
  fullImage
@@ -72,8 +71,8 @@ it('renders Single Message with full width image and no text correctly', () => {
72
71
  const tree = renderWithTheme(
73
72
  <SingleMessage
74
73
  backgroundColor="purple"
75
- imageSet={data.images}
76
- image={data.image}
74
+ imageSet={defaultData.images}
75
+ image={defaultData.image}
77
76
  imageAltText=""
78
77
  copyFirst={false}
79
78
  fullImage
@@ -87,9 +86,9 @@ it('renders Single Message with 100% vertical height image correctly', () => {
87
86
  const tree = renderWithTheme(
88
87
  <SingleMessage
89
88
  backgroundColor="purple"
90
- imageLow={data.imageLow}
91
- imageSet={data.images}
92
- image={data.image}
89
+ imageLow={defaultData.imageLow}
90
+ imageSet={defaultData.images}
91
+ image={defaultData.image}
93
92
  imageAltText=""
94
93
  vhFull
95
94
  >
@@ -107,12 +106,12 @@ it('renders Single Message with double image correctly', () => {
107
106
  const tree = renderWithTheme(
108
107
  <SingleMessage
109
108
  backgroundColor="yellow"
110
- imageLow={data.imageLow}
111
- imageSet={data.images}
112
- image={data.image}
109
+ imageLow={defaultData.imageLow}
110
+ imageSet={defaultData.images}
111
+ image={defaultData.image}
113
112
  imageAltText=""
114
- imageSet2={data.images}
115
- image2={data.image}
113
+ imageSet2={defaultData.images}
114
+ image2={defaultData.image}
116
115
  imageAltText2=""
117
116
  >
118
117
  <Text tag="p" color="black" size="xxl">
@@ -3,8 +3,7 @@
3
3
  ## Image align left and CTA are clickable and links user through to full conten
4
4
 
5
5
  ```js
6
- const data = require('../../../styleguide/data/data').default;
7
- import Text from '../../Atoms/Text/Text';
6
+ const defaultData = require('../../../styleguide/data/data').defaultData;import Text from '../../Atoms/Text/Text';
8
7
  import Link from '../../Atoms/Link/Link';
9
8
  import styled from 'styled-components';
10
9
  import spacing from '../../../theme/shared/spacing';
@@ -29,8 +28,8 @@ const Title = styled(Text)`
29
28
  link='/home'
30
29
  linkLabel='Check out'
31
30
  backgroundColor='white'
32
- imageLow={data.image}
33
- images={data.images}
31
+ imageLow={defaultData.image}
32
+ images={defaultData.images}
34
33
  imageAltText='Happy man going to work'
35
34
  subtitle="Subtitle"
36
35
  height='100%'
@@ -51,8 +50,7 @@ const Title = styled(Text)`
51
50
  ## Image align right and CTA are clickable and links user through to full content
52
51
 
53
52
  ```js
54
- const data = require('../../../styleguide/data/data').default;
55
- import Text from '../../Atoms/Text/Text';
53
+ const defaultData = require('../../../styleguide/data/data').defaultData;import Text from '../../Atoms/Text/Text';
56
54
  import Link from '../../Atoms/Link/Link';
57
55
  import styled from 'styled-components';
58
56
  import spacing from '../../../theme/shared/spacing';
@@ -77,8 +75,8 @@ const Title = styled(Text)`
77
75
  ctaBgColor="blue_dark"
78
76
  backgroundColor='white'
79
77
  imageLeft={false}
80
- imageLow={data.image}
81
- images={data.images}
78
+ imageLow={defaultData.image}
79
+ images={defaultData.images}
82
80
  imageAltText='Happy man going to work'
83
81
  subtitle="Subtitle"
84
82
  height='100%'
@@ -98,8 +96,7 @@ const Title = styled(Text)`
98
96
  ## Image align with non CTA
99
97
 
100
98
  ```js
101
- const data = require('../../../styleguide/data/data').default;
102
- import Text from '../../Atoms/Text/Text';
99
+ const defaultData = require('../../../styleguide/data/data').defaultData;import Text from '../../Atoms/Text/Text';
103
100
  import Link from '../../Atoms/Link/Link';
104
101
  import styled from 'styled-components';
105
102
  import spacing from '../../../theme/shared/spacing';
@@ -122,8 +119,8 @@ const Title = styled(Text)`
122
119
  ctaBgColor="blue_dark"
123
120
  backgroundColor='white'
124
121
  imageLeft={true}
125
- imageLow={data.image}
126
- images={data.images}
122
+ imageLow={defaultData.image}
123
+ images={defaultData.images}
127
124
  imageAltText='Happy man going to work'
128
125
  subtitle="Subtitle"
129
126
  height='100%'
@@ -143,8 +140,7 @@ const Title = styled(Text)`
143
140
  ## Using the linkIcon prop (to display download icon)
144
141
 
145
142
  ```js
146
- const data = require('../../../styleguide/data/data').default;
147
- import Text from '../../Atoms/Text/Text';
143
+ const defaultData = require('../../../styleguide/data/data').defaultData;import Text from '../../Atoms/Text/Text';
148
144
  import Link from '../../Atoms/Link/Link';
149
145
  import styled from 'styled-components';
150
146
  import spacing from '../../../theme/shared/spacing';
@@ -155,9 +151,9 @@ import Download from '../../Atoms/Icons/Download';
155
151
  link="https://assets.ctfassets.net/zsfivwzfgl3t/EsIEuI1teYkbLB7peOtqP/b43a905cffd89115d642fe5a84ff020a/RND21_fundraise_moneybuys_poster.pdf"
156
152
  linkLabel='Download this'
157
153
  linkIcon={<Download />}
158
- imageLow={data.image}
154
+ imageLow={defaultData.image}
159
155
  imageLeft={true}
160
- images={data.images}
156
+ images={defaultData.images}
161
157
  >
162
158
  <Text tag='p'>
163
159
  Whatever you’ve got planned, the Sport Relief shop has everything you need
@@ -171,8 +167,7 @@ import Download from '../../Atoms/Icons/Download';
171
167
  ## Video with no CTA
172
168
 
173
169
  ```js
174
- const data = require('../../../styleguide/data/data').default;
175
- import Text from '../../Atoms/Text/Text';
170
+ const defaultData = require('../../../styleguide/data/data').defaultData;import Text from '../../Atoms/Text/Text';
176
171
  import Link from '../../Atoms/Link/Link';
177
172
  import styled from 'styled-components';
178
173
  import spacing from '../../../theme/shared/spacing';
@@ -180,8 +175,8 @@ import Download from '../../Atoms/Icons/Download';
180
175
 
181
176
  <div>
182
177
  <SingleMessageDs
183
- imageLow={data.image}
184
- images={data.images}
178
+ imageLow={defaultData.image}
179
+ images={defaultData.images}
185
180
  youTubeId="faz0JeBB41M"
186
181
  imageLeft={true}
187
182
  >
@@ -4,8 +4,7 @@ import renderWithTheme from '../../../hoc/shallowWithTheme';
4
4
  import SingleMessageDs from './SingleMessageDs';
5
5
  import Text from '../../Atoms/Text/Text';
6
6
  import Download from '../../Atoms/Icons/Download';
7
- import data from '../../../styleguide/data/data';
8
-
7
+ import { defaultData } from '../../../styleguide/data/data';
9
8
  it('renders correctly', () => {
10
9
  const tree = renderWithTheme(
11
10
  <SingleMessageDs
@@ -15,8 +14,8 @@ it('renders correctly', () => {
15
14
  ctaBgColor="blue_dark"
16
15
  backgroundColor="white"
17
16
  imageDirection="right"
18
- imageLow={data.image}
19
- images={data.images}
17
+ imageLow={defaultData.image}
18
+ images={defaultData.images}
20
19
  imageAltText="Happy man going to work"
21
20
  subtitle="Subtitle"
22
21
  title="Heading Line 1 Heading Line 2"
@@ -1,9 +1,12 @@
1
1
  import React from 'react';
2
+ import { useMediaQuery } from 'react-responsive';
2
3
  import PropTypes from 'prop-types';
3
4
 
5
+ import { screen } from '../../../theme/shared/size';
4
6
  import Text from '../../Atoms/Text/Text';
5
7
  import Form from './Form/Form';
6
8
  import {
9
+ MobImage,
7
10
  BgImage,
8
11
  Container,
9
12
  Header,
@@ -25,55 +28,82 @@ const Donate = ({
25
28
  images,
26
29
  image,
27
30
  imageLow,
31
+ mobileImages,
32
+ mobileImage,
33
+ mobileImageLow,
34
+ mobileAlt,
28
35
  mbshipID,
29
- noMoneyBuys
30
- }) => (
31
- <Container backgroundColor={backgroundColor} id={mbshipID}>
32
- {images ? (
33
- <BgImage
34
- backgroundColor={backgroundColor}
35
- image={image}
36
- images={images}
37
- imageLow={imageLow}
38
- objectFit="cover"
39
- width="100%"
40
- height="100%"
41
- alt={alt}
42
- isBackgroundImage
43
- />
44
- ) : null}
36
+ noMoneyBuys,
37
+ PopUpText
38
+ }) => {
39
+ const isDesktop = useMediaQuery({ query: `(min-width: ${screen.medium})` });
45
40
 
46
- <Wrapper formAlignRight={formAlignRight}>
47
- <Header formAlignRight={formAlignRight}>
48
- <HeaderInner>
49
- <Text
50
- tag="h2"
51
- color="white"
52
- size="big"
53
- family="Anton"
54
- weight="normal"
55
- uppercase
56
- >
57
- {title}
58
- </Text>
59
- <Text tag="p" color="white" size="m">
60
- {subtitle}
61
- </Text>
62
- </HeaderInner>
63
- </Header>
41
+ return (
42
+ <Container backgroundColor={backgroundColor} id={mbshipID}>
43
+ {!isDesktop && mobileImages ? (
44
+ <MobImage
45
+ backgroundColor={backgroundColor}
46
+ image={mobileImage}
47
+ images={mobileImages}
48
+ imageLow={mobileImageLow}
49
+ objectFit="cover"
50
+ width="100%"
51
+ height="100%"
52
+ alt={mobileAlt}
53
+ />
54
+ ) : null}
64
55
 
65
- <Form
66
- data={data}
67
- otherDescription={otherDescription}
68
- cartID={cartID}
69
- clientID={clientID}
70
- mbshipID={mbshipID}
71
- donateLink={donateLink}
72
- noMoneyBuys={noMoneyBuys}
73
- />
74
- </Wrapper>
75
- </Container>
76
- );
56
+ {isDesktop && images ? (
57
+ <BgImage
58
+ backgroundColor={backgroundColor}
59
+ image={image}
60
+ images={images}
61
+ imageLow={imageLow}
62
+ objectFit="cover"
63
+ width="100%"
64
+ height="100%"
65
+ alt={alt}
66
+ isBackgroundImage
67
+ />
68
+ ) : null}
69
+
70
+ <Wrapper formAlignRight={formAlignRight}>
71
+ <Header formAlignRight={formAlignRight}>
72
+ <HeaderInner>
73
+ {subtitle && (
74
+ <>
75
+ <Text
76
+ tag="h2"
77
+ color="white"
78
+ size="big"
79
+ family="Anton"
80
+ weight="normal"
81
+ uppercase
82
+ >
83
+ {title}
84
+ </Text>
85
+ <Text tag="p" color="white" size="m">
86
+ {subtitle}
87
+ </Text>
88
+ </>
89
+ )}
90
+ </HeaderInner>
91
+ </Header>
92
+
93
+ <Form
94
+ data={data}
95
+ otherDescription={otherDescription}
96
+ cartID={cartID}
97
+ clientID={clientID}
98
+ mbshipID={mbshipID}
99
+ donateLink={donateLink}
100
+ noMoneyBuys={noMoneyBuys}
101
+ PopUpText={PopUpText}
102
+ />
103
+ </Wrapper>
104
+ </Container>
105
+ );
106
+ };
77
107
 
78
108
  Donate.propTypes = {
79
109
  alt: PropTypes.string,
@@ -83,14 +113,19 @@ Donate.propTypes = {
83
113
  donateLink: PropTypes.string.isRequired,
84
114
  title: PropTypes.string.isRequired,
85
115
  otherDescription: PropTypes.string,
86
- subtitle: PropTypes.string.isRequired,
116
+ subtitle: PropTypes.string,
87
117
  formAlignRight: PropTypes.bool,
88
118
  imageLow: PropTypes.string,
89
119
  image: PropTypes.string,
90
120
  images: PropTypes.string,
121
+ mobileImageLow: PropTypes.string,
122
+ mobileImage: PropTypes.string,
123
+ mobileImages: PropTypes.string,
124
+ mobileAlt: PropTypes.string,
91
125
  backgroundColor: PropTypes.string,
92
126
  mbshipID: PropTypes.string,
93
- noMoneyBuys: PropTypes.bool
127
+ noMoneyBuys: PropTypes.bool,
128
+ PopUpText: PropTypes.string
94
129
  };
95
130
 
96
131
  Donate.defaultProps = {
@@ -100,11 +135,17 @@ Donate.defaultProps = {
100
135
  imageLow: null,
101
136
  image: null,
102
137
  images: null,
103
- backgroundColor: null,
138
+ mobileImageLow: null,
139
+ mobileImage: null,
140
+ mobileImages: null,
141
+ mobileAlt: '',
142
+ backgroundColor: 'blue_dark',
104
143
  mbshipID: null,
105
144
  otherDescription:
106
145
  'will help us fund amazing projects in the UK and around the world.',
107
- noMoneyBuys: false
146
+ subtitle: '',
147
+ 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."
108
149
  };
109
150
 
110
151
  export default Donate;