@comicrelief/component-library 6.2.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.
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 +38 -7
  22. package/dist/components/Organisms/Donate/Donate.md +149 -14
  23. package/dist/components/Organisms/Donate/Donate.style.js +61 -45
  24. package/dist/components/Organisms/Donate/Donate.test.js +9 -8
  25. package/dist/components/Organisms/Donate/Form/Form.js +8 -2
  26. package/dist/components/Organisms/Donate/Form/PopUpComponent.js +74 -0
  27. package/dist/components/Organisms/Donate/__snapshots__/Donate.test.js.snap +345 -389
  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 +95 -50
  54. package/src/components/Organisms/Donate/Donate.md +149 -14
  55. package/src/components/Organisms/Donate/Donate.style.js +16 -1
  56. package/src/components/Organisms/Donate/Donate.test.js +8 -7
  57. package/src/components/Organisms/Donate/Form/Form.js +12 -2
  58. package/src/components/Organisms/Donate/Form/PopUpComponent.js +63 -0
  59. package/src/components/Organisms/Donate/__snapshots__/Donate.test.js.snap +345 -389
  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,17 +1,20 @@
1
1
  # Donate
2
2
 
3
- ## Form align right
3
+ ## Form align right, with red backgound on desktop view
4
4
 
5
5
  ```js
6
6
  import data from './dev-data/data';
7
- const pictures = require('../../../styleguide/data/data').default;
7
+ const mobilePictures = require('../../../styleguide/data/data').mobileImages;
8
+ const desktopPictures = require('../../../styleguide/data/data').defaultData;
8
9
 
9
10
  <Donate
10
11
  alt="Background image"
11
- backgroundColor="blue_dark"
12
+ backgroundColor="red"
12
13
  formAlignRight={true}
13
- imageLow={pictures.imageLow}
14
- images={pictures.images}
14
+ imageLow={desktopPictures.imageLow}
15
+ images={desktopPictures.images}
16
+ mobileImageLow={mobilePictures.imageLow}
17
+ mobileImages={mobilePictures.images}
15
18
  data={data}
16
19
  mbshipID="mship-1"
17
20
  donateLink="https://donation.comicrelief.com/"
@@ -27,13 +30,16 @@ const pictures = require('../../../styleguide/data/data').default;
27
30
 
28
31
  ```js
29
32
  import data from './dev-data/data';
30
- const pictures = require('../../../styleguide/data/data').default;
33
+ const mobilePictures = require('../../../styleguide/data/data').mobileImages;
34
+ const desktopPictures = require('../../../styleguide/data/data').defaultData;
31
35
 
32
36
  <Donate
33
37
  backgroundColor="blue_dark"
34
38
  formAlignRight={false}
35
- imageLow={pictures.imageLow}
36
- images={pictures.images}
39
+ imageLow={desktopPictures.imageLow}
40
+ images={desktopPictures.images}
41
+ mobileImageLow={mobilePictures.imageLow}
42
+ mobileImages={mobilePictures.images}
37
43
  data={data}
38
44
  mbshipID="mship-1"
39
45
  donateLink="https://donation.comicrelief.com/"
@@ -49,13 +55,16 @@ const pictures = require('../../../styleguide/data/data').default;
49
55
 
50
56
  ```js
51
57
  import data from './dev-data/data-single';
52
- const pictures = require('../../../styleguide/data/data').default;
58
+ const mobilePictures = require('../../../styleguide/data/data').mobileImages;
59
+ const desktopPictures = require('../../../styleguide/data/data').defaultData;
53
60
 
54
61
  <Donate
55
62
  backgroundColor="blue_dark"
56
63
  formAlignRight={false}
57
- imageLow={pictures.imageLow}
58
- images={pictures.images}
64
+ imageLow={desktopPictures.imageLow}
65
+ images={desktopPictures.images}
66
+ mobileImageLow={mobilePictures.imageLow}
67
+ mobileImages={mobilePictures.images}
59
68
  data={data}
60
69
  mbshipID="mship-1"
61
70
  donateLink="https://donation.comicrelief.com/"
@@ -71,13 +80,16 @@ const pictures = require('../../../styleguide/data/data').default;
71
80
 
72
81
  ```js
73
82
  import data from './dev-data/data-single';
74
- const pictures = require('../../../styleguide/data/data').default;
83
+ const mobilePictures = require('../../../styleguide/data/data').mobileImages;
84
+ const desktopPictures = require('../../../styleguide/data/data').defaultData;
75
85
 
76
86
  <Donate
77
87
  backgroundColor="blue_dark"
78
88
  formAlignRight={false}
79
- imageLow={pictures.imageLow}
80
- images={pictures.images}
89
+ imageLow={desktopPictures.imageLow}
90
+ images={desktopPictures.images}
91
+ mobileImageLow={mobilePictures.imageLow}
92
+ mobileImages={mobilePictures.images}
81
93
  data={data}
82
94
  mbshipID="mship-1"
83
95
  donateLink="https://donation.comicrelief.com/"
@@ -89,3 +101,126 @@ const pictures = require('../../../styleguide/data/data').default;
89
101
  otherDescription="will help us fund amazing projects in the UK and around the world."
90
102
  />;
91
103
  ```
104
+
105
+ ## Form align right - no subtitle
106
+
107
+ ```js
108
+ import data from './dev-data/data';
109
+ const mobilePictures = require('../../../styleguide/data/data').mobileImages;
110
+ const desktopPictures = require('../../../styleguide/data/data').defaultData;
111
+
112
+ <Donate
113
+ alt="Background image"
114
+ backgroundColor="blue_dark"
115
+ formAlignRight={true}
116
+ imageLow={desktopPictures.imageLow}
117
+ images={desktopPictures.images}
118
+ mobileImageLow={mobilePictures.imageLow}
119
+ mobileImages={mobilePictures.images}
120
+ data={data}
121
+ mbshipID="mship-1"
122
+ donateLink="https://donation.comicrelief.com/"
123
+ clientID="donate"
124
+ cartID="default-comicrelief"
125
+ title="Donate Now"
126
+ subtitle=""
127
+ otherDescription="will help us fund amazing projects in the UK and around the world."
128
+ />;
129
+ ```
130
+
131
+ ## Form align left - no subtitle
132
+
133
+ ```js
134
+ import data from './dev-data/data';
135
+ const mobilePictures = require('../../../styleguide/data/data').mobileImages;
136
+ const desktopPictures = require('../../../styleguide/data/data').defaultData;
137
+
138
+ <Donate
139
+ backgroundColor="blue_dark"
140
+ formAlignRight={false}
141
+ imageLow={desktopPictures.imageLow}
142
+ images={desktopPictures.images}
143
+ mobileImageLow={mobilePictures.imageLow}
144
+ mobileImages={mobilePictures.images}
145
+ data={data}
146
+ mbshipID="mship-1"
147
+ donateLink="https://donation.comicrelief.com/"
148
+ clientID="donate"
149
+ cartID="default-comicrelief"
150
+ title="Donate Now"
151
+ subtitle=""
152
+ otherDescription="will help us fund amazing projects in the UK and around the world."
153
+ />;
154
+ ```
155
+
156
+ ## Single Giving - no subtitle
157
+
158
+ ```js
159
+ import data from './dev-data/data-single';
160
+ const mobilePictures = require('../../../styleguide/data/data').mobileImages;
161
+ const desktopPictures = require('../../../styleguide/data/data').defaultData;
162
+
163
+ <Donate
164
+ backgroundColor="blue_dark"
165
+ formAlignRight={false}
166
+ imageLow={desktopPictures.imageLow}
167
+ images={desktopPictures.images}
168
+ mobileImageLow={mobilePictures.imageLow}
169
+ mobileImages={mobilePictures.images}
170
+ data={data}
171
+ mbshipID="mship-1"
172
+ donateLink="https://donation.comicrelief.com/"
173
+ clientID="donate"
174
+ cartID="default-comicrelief"
175
+ title="Donate Now"
176
+ subtitle=""
177
+ otherDescription="will help us fund amazing projects in the UK and around the world."
178
+ />;
179
+ ```
180
+
181
+ ## Single Giving "No Money Buys"
182
+
183
+ ```js
184
+ import data from './dev-data/data-single';
185
+ const mobilePictures = require('../../../styleguide/data/data').mobileImages;
186
+ const desktopPictures = require('../../../styleguide/data/data').defaultData;
187
+
188
+ <Donate
189
+ backgroundColor="blue_dark"
190
+ formAlignRight={false}
191
+ imageLow={desktopPictures.imageLow}
192
+ images={desktopPictures.images}
193
+ mobileImageLow={mobilePictures.imageLow}
194
+ mobileImages={mobilePictures.images}
195
+ data={data}
196
+ mbshipID="mship-1"
197
+ donateLink="https://donation.comicrelief.com/"
198
+ clientID="donate"
199
+ cartID="default-comicrelief"
200
+ title="Donate Now"
201
+ noMoneyBuys
202
+ subtitle=""
203
+ otherDescription="will help us fund amazing projects in the UK and around the world."
204
+ />;
205
+ ```
206
+
207
+ ## Single Giving "No Money Buys", no background image, overriding 'choose amount' text
208
+
209
+ ```js
210
+ import data from './dev-data/data-single';
211
+
212
+ <Donate
213
+ backgroundColor="blue_dark"
214
+ formAlignRight={false}
215
+ data={data}
216
+ mbshipID="mship-1"
217
+ donateLink="https://donation.comicrelief.com/"
218
+ clientID="donate"
219
+ cartID="default-comicrelief"
220
+ title="Donate Now"
221
+ noMoneyBuys
222
+ subtitle=""
223
+ otherDescription="will help us fund amazing projects in the UK and around the world."
224
+ chooseAmountText="Overridden via the 'choose amount text' props"
225
+ />;
226
+ ```
@@ -1,4 +1,5 @@
1
1
  import styled from 'styled-components';
2
+ // import styled, { css } from 'styled-components';
2
3
 
3
4
  import Input from '../../Atoms/Input/Input';
4
5
  import Text from '../../Atoms/Text/Text';
@@ -8,18 +9,30 @@ import Picture from '../../Atoms/Picture/Picture';
8
9
  import zIndex from '../../../theme/shared/zIndex';
9
10
 
10
11
  const Container = styled.div`
11
- background-color: ${({ theme, backgroundColor }) => theme.color(backgroundColor)};
12
12
  position: relative;
13
13
  display: flex;
14
+ flex-direction: column;
14
15
  justify-content: center;
15
16
  height: auto;
17
+ background-color: ${({ theme }) => theme.color('blue_dark')};
16
18
  ${media('medium')} {
19
+ flex-direction: row;
17
20
  align-items: center;
18
21
  justify-content: inherit;
22
+ background-color: ${({ theme, backgroundColor }) => theme.color(backgroundColor)};
19
23
  }
20
24
  `;
21
25
 
26
+ const PopUp = styled.div`
27
+ background: green;
28
+ height: 100px;
29
+ `;
30
+
31
+ const MobImage = styled(Picture)`
32
+ `;
33
+
22
34
  const BgImage = styled(Picture)`
35
+ display: block;
23
36
  position: absolute;
24
37
  bottom: 0;
25
38
  left: 0;
@@ -223,9 +236,11 @@ const Button = styled.button`
223
236
 
224
237
  export {
225
238
  BgImage,
239
+ MobImage,
226
240
  Button,
227
241
  Copy,
228
242
  Container,
243
+ PopUp,
229
244
  Error,
230
245
  FormFieldset,
231
246
  FormWrapper,
@@ -5,7 +5,7 @@ import Donate from './Donate';
5
5
  import data from './dev-data/data';
6
6
  import singleData from './dev-data/data-single';
7
7
 
8
- const pictures = require('../../../styleguide/data/data').default;
8
+ const defaultData = require('../../../styleguide/data/data').defaultData;
9
9
 
10
10
  it('Monthly donation renders correctly', () => {
11
11
  const tree = renderWithTheme(
@@ -13,8 +13,8 @@ it('Monthly donation renders correctly', () => {
13
13
  alt="Background image"
14
14
  backgroundColor="blue_dark"
15
15
  formAlignRight
16
- imageLow={pictures.imageLow}
17
- images={pictures.images}
16
+ imageLow={defaultData.pictures.imageLow}
17
+ images={defaultData.pictures.images}
18
18
  data={data}
19
19
  mbshipID="mship-1"
20
20
  donateLink="https://donation.comicrelief.com/"
@@ -34,8 +34,8 @@ it('Single donation renders correctly', () => {
34
34
  <Donate
35
35
  backgroundColor="blue_dark"
36
36
  formAlignRight={false}
37
- imageLow={pictures.imageLow}
38
- images={pictures.images}
37
+ imageLow={defaultData.pictures.imageLow}
38
+ images={defaultData.pictures.images}
39
39
  data={singleData}
40
40
  mbshipID="mship-1"
41
41
  donateLink="https://donation.comicrelief.com/"
@@ -55,8 +55,8 @@ it('Single donation with no Money Buys renders correctly', () => {
55
55
  <Donate
56
56
  backgroundColor="blue_dark"
57
57
  formAlignRight={false}
58
- imageLow={pictures.imageLow}
59
- images={pictures.images}
58
+ imageLow={defaultData.pictures.imageLow}
59
+ images={defaultData.pictures.images}
60
60
  data={singleData}
61
61
  mbshipID="mship-1"
62
62
  donateLink="https://donation.comicrelief.com/"
@@ -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
 
@@ -1,6 +1,7 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
 
4
+ import PopUpComponent from './PopUpComponent';
4
5
  import Text from '../../../Atoms/Text/Text';
5
6
  import MoneyBox from '../MoneyBox/MoneyBox';
6
7
  import {
@@ -30,6 +31,8 @@ const Signup = ({
30
31
  cartID,
31
32
  mbshipID,
32
33
  noMoneyBuys,
34
+ PopUpText,
35
+ chooseAmountText,
33
36
  ...rest
34
37
  }) => {
35
38
  const [givingType, setGivingType] = useState('single');
@@ -122,6 +125,10 @@ const Signup = ({
122
125
  />
123
126
  )}
124
127
 
128
+ {(givingType === 'single' && showGivingSelector)
129
+ && <PopUpComponent PopUpText={PopUpText} />
130
+ }
131
+
125
132
  <Form
126
133
  onSubmit={e => submitDonation(
127
134
  e,
@@ -136,7 +143,7 @@ const Signup = ({
136
143
  <OuterFieldset>
137
144
  <Legend>
138
145
  <Text tag="span" size="l" weight="bold">
139
- {`${noMoneyBuys ? 'Enter' : 'Choose'} an amount to give`}
146
+ {chooseAmountText || `${noMoneyBuys ? 'Enter' : 'Choose'} an amount to give`}
140
147
  </Text>
141
148
  </Legend>
142
149
  {!noMoneyBuys && (
@@ -213,11 +220,14 @@ Signup.propTypes = {
213
220
  otherDescription: PropTypes.string.isRequired,
214
221
  mbshipID: PropTypes.string.isRequired,
215
222
  noMoneyBuys: PropTypes.bool,
216
- data: PropTypes.objectOf(PropTypes.shape)
223
+ data: PropTypes.objectOf(PropTypes.shape),
224
+ PopUpText: PropTypes.string.isRequired,
225
+ chooseAmountText: PropTypes.string.isRequired
217
226
  };
218
227
 
219
228
  Signup.defaultProps = {
220
229
  noMoneyBuys: false,
221
230
  data: {}
222
231
  };
232
+
223
233
  export default Signup;
@@ -0,0 +1,63 @@
1
+ /* eslint-disable */
2
+ import React, { useState } from 'react';
3
+ import styled from 'styled-components';
4
+ import Text from '../../../Atoms/Text/Text';
5
+ import spacing from '../../../../theme/shared/spacing';
6
+ import { media } from '../../../../theme/shared/size';
7
+ import PropTypes from 'prop-types';
8
+ import CloseCross from '../assets/close.svg';
9
+
10
+ const StyledPopUp = styled.div`
11
+ display: ${props => props.isPop ? "grid" : "none"};
12
+ gap: ${spacing('sm')};
13
+ background-color: ${({ theme }) => theme.color('white')};
14
+ box-shadow: 0px 0px 16px rgba(0, 0, 0, 0.15);
15
+ border-radius: 8px;
16
+
17
+ ${media('small')} {
18
+ width: 450px;
19
+ margin-right: auto;
20
+ margin-left: auto;
21
+ }
22
+ `;
23
+
24
+ const TextWrapper = styled.div`
25
+ margin: 0 32px 32px;
26
+ `;
27
+
28
+ const Button = styled.button`
29
+ justify-self: end;
30
+ background: transparent;
31
+ border: 0;
32
+ cursor: pointer;
33
+ :active,
34
+ :focus,
35
+ :hover {
36
+ outline: none;
37
+ border: 1px solid ${({ theme }) => theme.color('grey')};
38
+ }
39
+ margin: 17px 17px 0;
40
+ /* This sets the size of the svg close.svg icon */
41
+ width: 20px;
42
+ `;
43
+
44
+ const PopUpComponent = ({ PopUpText }) => {
45
+ const [isPop, setIsPop] = useState(true);
46
+
47
+ return (
48
+ <StyledPopUp isPop={isPop}>
49
+ <Button onClick={() => setIsPop(false)} aria-label="Close">
50
+ <img src={CloseCross} alt="Close cross icon"/>
51
+ </Button>
52
+ <TextWrapper>
53
+ <Text>{ PopUpText }</Text>
54
+ </TextWrapper>
55
+ </StyledPopUp>
56
+ )
57
+ };
58
+
59
+ PopUpComponent.propTypes = {
60
+ PopUpText: PropTypes.string.isRequired
61
+ };
62
+
63
+ export default PopUpComponent;