@comicrelief/component-library 8.52.3 → 8.53.1
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.
- package/.github/workflows/main.yml +1 -1
- package/dist/components/Molecules/HeroBanner/HeroBanner.md +1 -1
- package/dist/components/Molecules/HeroBanner/HeroBanner.style.js +4 -4
- package/dist/components/Molecules/HeroBanner/__snapshots__/HeroBanner.test.js.snap +6 -0
- package/dist/components/Organisms/Donate/Donate.js +3 -0
- package/dist/components/Organisms/Donate/Form/Form.js +0 -1
- package/dist/components/Organisms/DonateBanner/DonateBanner.js +132 -0
- package/dist/components/Organisms/DonateBanner/DonateBanner.md +168 -0
- package/dist/components/Organisms/DonateBanner/DonateBanner.style.js +291 -0
- package/dist/components/Organisms/DonateBanner/DonateBanner.test.js +134 -0
- package/dist/components/Organisms/DonateBanner/Form/Form.js +214 -0
- package/dist/components/Organisms/DonateBanner/Form/PopUpComponent.js +70 -0
- package/dist/components/Organisms/DonateBanner/GivingSelector/GivingSelector.js +50 -0
- package/dist/components/Organisms/DonateBanner/GivingSelector/GivingSelector.style.js +73 -0
- package/dist/components/Organisms/DonateBanner/MoneyBuy/MoneyBuy.js +83 -0
- package/dist/components/Organisms/DonateBanner/__snapshots__/DonateBanner.test.js.snap +3170 -0
- package/dist/components/Organisms/DonateBanner/_utils.js +41 -0
- package/dist/components/Organisms/DonateBanner/assets/close.svg +3 -0
- package/dist/components/Organisms/DonateBanner/dev-data/data-high-value.js +33 -0
- package/dist/components/Organisms/DonateBanner/dev-data/data-monthly.js +22 -0
- package/dist/components/Organisms/DonateBanner/dev-data/data-single.js +22 -0
- package/dist/components/Organisms/DonateBanner/dev-data/data.js +33 -0
- package/dist/index.js +7 -0
- package/package.json +1 -1
- package/src/components/Molecules/HeroBanner/HeroBanner.md +1 -1
- package/src/components/Molecules/HeroBanner/HeroBanner.style.js +15 -2
- package/src/components/Molecules/HeroBanner/__snapshots__/HeroBanner.test.js.snap +6 -0
- package/src/components/Organisms/Donate/Donate.js +5 -0
- package/src/components/Organisms/Donate/Form/Form.js +0 -1
- package/src/components/Organisms/DonateBanner/DonateBanner.js +210 -0
- package/src/components/Organisms/DonateBanner/DonateBanner.md +168 -0
- package/src/components/Organisms/DonateBanner/DonateBanner.style.js +320 -0
- package/src/components/Organisms/DonateBanner/DonateBanner.test.js +151 -0
- package/src/components/Organisms/DonateBanner/Form/Form.js +332 -0
- package/src/components/Organisms/DonateBanner/Form/PopUpComponent.js +110 -0
- package/src/components/Organisms/DonateBanner/GivingSelector/GivingSelector.js +61 -0
- package/src/components/Organisms/DonateBanner/GivingSelector/GivingSelector.style.js +71 -0
- package/src/components/Organisms/DonateBanner/MoneyBuy/MoneyBuy.js +58 -0
- package/src/components/Organisms/DonateBanner/__snapshots__/DonateBanner.test.js.snap +3170 -0
- package/src/components/Organisms/DonateBanner/_utils.js +34 -0
- package/src/components/Organisms/DonateBanner/assets/close.svg +3 -0
- package/src/components/Organisms/DonateBanner/dev-data/data-high-value.js +41 -0
- package/src/components/Organisms/DonateBanner/dev-data/data-monthly.js +23 -0
- package/src/components/Organisms/DonateBanner/dev-data/data-single.js +23 -0
- package/src/components/Organisms/DonateBanner/dev-data/data.js +41 -0
- package/src/index.js +1 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# DonateBanner
|
|
2
|
+
|
|
3
|
+
## Image banner (widget right), custom padding + background
|
|
4
|
+
|
|
5
|
+
```js
|
|
6
|
+
import data from './dev-data/data';
|
|
7
|
+
const desktopPictures = require('../../../styleguide/data/data').defaultData;
|
|
8
|
+
const mobilePictures = require('../../../styleguide/data/data').mobileImages;
|
|
9
|
+
|
|
10
|
+
const imageL = {
|
|
11
|
+
images: desktopPictures.images,
|
|
12
|
+
imageLow: desktopPictures.imageLow,
|
|
13
|
+
alt: 'Background image'
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const imageM = {
|
|
17
|
+
images: desktopPictures.images,
|
|
18
|
+
imageLow: desktopPictures.imageLow,
|
|
19
|
+
alt: 'Background image'
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const imageS = {
|
|
23
|
+
images: mobilePictures.images,
|
|
24
|
+
imageLow: mobilePictures.imageLow,
|
|
25
|
+
alt: 'Background image'
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
<DonateBanner
|
|
29
|
+
pageBackgroundColour="grey_light"
|
|
30
|
+
paddingAbove="0rem"
|
|
31
|
+
paddingBelow="2rem"
|
|
32
|
+
donateOrientation="right"
|
|
33
|
+
imageL={imageL}
|
|
34
|
+
imageM={imageM}
|
|
35
|
+
imageS={imageS}
|
|
36
|
+
data={data}
|
|
37
|
+
mbshipID="mbship-1"
|
|
38
|
+
donateLink="https://donation.comicrelief.com/"
|
|
39
|
+
clientID="donate"
|
|
40
|
+
cartID="default-comicrelief"
|
|
41
|
+
title="Donate Now"
|
|
42
|
+
subtitle="Please help us fund life-changing projects in the UK and around the world."
|
|
43
|
+
/>;
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Image banner (widget left), monthly title/subtitle + choose amount text overrides
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
import data from './dev-data/data';
|
|
50
|
+
const desktopPictures = require('../../../styleguide/data/data').defaultData;
|
|
51
|
+
const mobilePictures = require('../../../styleguide/data/data').mobileImages;
|
|
52
|
+
|
|
53
|
+
const imageL = {
|
|
54
|
+
images: desktopPictures.images,
|
|
55
|
+
imageLow: desktopPictures.imageLow,
|
|
56
|
+
alt: 'Background image'
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const imageM = {
|
|
60
|
+
images: desktopPictures.images,
|
|
61
|
+
imageLow: desktopPictures.imageLow,
|
|
62
|
+
alt: 'Background image'
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const imageS = {
|
|
66
|
+
images: mobilePictures.images,
|
|
67
|
+
imageLow: mobilePictures.imageLow,
|
|
68
|
+
alt: 'Background image'
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
<DonateBanner
|
|
72
|
+
pageBackgroundColour="grey_light"
|
|
73
|
+
paddingAbove="2rem"
|
|
74
|
+
paddingBelow="2rem"
|
|
75
|
+
donateOrientation="left"
|
|
76
|
+
imageL={imageL}
|
|
77
|
+
imageM={imageM}
|
|
78
|
+
imageS={imageS}
|
|
79
|
+
data={data}
|
|
80
|
+
mbshipID="mbship-2"
|
|
81
|
+
donateLink="https://donation.comicrelief.com/"
|
|
82
|
+
clientID="donate"
|
|
83
|
+
cartID="default-comicrelief"
|
|
84
|
+
title="Donate today"
|
|
85
|
+
subtitle="Your support can help people facing the toughest times."
|
|
86
|
+
monthlyTitle="Give monthly"
|
|
87
|
+
monthlySubtitle="A regular gift helps fund long-term impact."
|
|
88
|
+
chooseAmountText="Choose a one-off amount"
|
|
89
|
+
monthlyChooseAmountText="Choose a monthly amount"
|
|
90
|
+
popUpText="Switching to a single gift means less predictable funding."
|
|
91
|
+
/>;
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Text-only widget (no image), custom widget background + text colour
|
|
95
|
+
|
|
96
|
+
```js
|
|
97
|
+
import data from './dev-data/data-single';
|
|
98
|
+
|
|
99
|
+
<DonateBanner
|
|
100
|
+
donateWidgetIsTextOnly
|
|
101
|
+
pageBackgroundColour="rnd_25_glitzy_grape"
|
|
102
|
+
componentBackgroundColour="deep_violet_dark"
|
|
103
|
+
paddingAbove="2rem"
|
|
104
|
+
paddingBelow="2rem"
|
|
105
|
+
donateOrientation="right"
|
|
106
|
+
data={data}
|
|
107
|
+
mbshipID="mbship-3"
|
|
108
|
+
donateLink="https://donation.comicrelief.com/"
|
|
109
|
+
clientID="donate"
|
|
110
|
+
cartID="default-comicrelief"
|
|
111
|
+
title="Donate now"
|
|
112
|
+
subtitle="Make a difference today."
|
|
113
|
+
chooseAmountText="Enter an amount to give"
|
|
114
|
+
noMoneyBuys
|
|
115
|
+
/>;
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Text-only widget (no image), with the usual moneybuys, standard colours
|
|
119
|
+
|
|
120
|
+
```js
|
|
121
|
+
import data from './dev-data/data';
|
|
122
|
+
|
|
123
|
+
<DonateBanner
|
|
124
|
+
donateWidgetIsTextOnly
|
|
125
|
+
pageBackgroundColour="grey_light"
|
|
126
|
+
componentBackgroundColour="white"
|
|
127
|
+
paddingAbove="2rem"
|
|
128
|
+
paddingBelow="2rem"
|
|
129
|
+
donateOrientation="right"
|
|
130
|
+
data={data}
|
|
131
|
+
mbshipID="mbship-3b"
|
|
132
|
+
donateLink="https://donation.comicrelief.com/"
|
|
133
|
+
clientID="donate"
|
|
134
|
+
cartID="default-comicrelief"
|
|
135
|
+
title="Donate now"
|
|
136
|
+
subtitle="Choose an amount or pick a moneybuy."
|
|
137
|
+
/>;
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Different “Other amount” copy for single vs monthly
|
|
141
|
+
|
|
142
|
+
```js
|
|
143
|
+
import data from './dev-data/data';
|
|
144
|
+
const desktopPictures = require('../../../styleguide/data/data').defaultData;
|
|
145
|
+
|
|
146
|
+
const imageL = {
|
|
147
|
+
images: desktopPictures.images,
|
|
148
|
+
imageLow: desktopPictures.imageLow,
|
|
149
|
+
alt: 'Background image'
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
<DonateBanner
|
|
153
|
+
pageBackgroundColour="grey_light"
|
|
154
|
+
paddingAbove="0rem"
|
|
155
|
+
paddingBelow="0rem"
|
|
156
|
+
donateOrientation="left"
|
|
157
|
+
imageL={imageL}
|
|
158
|
+
data={data}
|
|
159
|
+
mbshipID="mbship-4"
|
|
160
|
+
donateLink="https://donation.comicrelief.com/"
|
|
161
|
+
clientID="donate"
|
|
162
|
+
cartID="default-comicrelief"
|
|
163
|
+
title="Donate now"
|
|
164
|
+
subtitle="Help fund life-changing work."
|
|
165
|
+
otherAmountText="can help support people in crisis."
|
|
166
|
+
monthlyOtherAmountText="each month can help provide long-term support."
|
|
167
|
+
/>;
|
|
168
|
+
```
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
|
|
3
|
+
import Input from '../../Atoms/Input/Input';
|
|
4
|
+
import Text from '../../Atoms/Text/Text';
|
|
5
|
+
import spacing from '../../../theme/shared/spacing';
|
|
6
|
+
import Picture from '../../Atoms/Picture/Picture';
|
|
7
|
+
import zIndex from '../../../theme/shared/zIndex';
|
|
8
|
+
|
|
9
|
+
const Container = styled.div`
|
|
10
|
+
position: relative;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
align-items: center;
|
|
15
|
+
height: auto;
|
|
16
|
+
margin: ${({ paddingAbove, paddingBelow }) => `${paddingAbove} 0 ${paddingBelow}`};
|
|
17
|
+
background-color: ${({ theme, pageBackgroundColour }) => theme.color(pageBackgroundColour)};
|
|
18
|
+
width: 100%;
|
|
19
|
+
padding: 2rem;
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
const InnerContainer = styled.div`
|
|
23
|
+
position: relative;
|
|
24
|
+
background-color: ${({ theme, componentBackgroundColour }) => theme.color(componentBackgroundColour)};
|
|
25
|
+
border-radius: 1rem;
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
padding: none;
|
|
28
|
+
width: 100%;
|
|
29
|
+
box-sizing: border-box;
|
|
30
|
+
@media ${({ theme }) => theme.allBreakpoints('L')} {
|
|
31
|
+
padding: ${spacing('l')};
|
|
32
|
+
${({ $donateWidgetIsTextOnly }) => $donateWidgetIsTextOnly && css`
|
|
33
|
+
padding-top: 7.5rem;
|
|
34
|
+
padding-bottom: 7.5rem;
|
|
35
|
+
`}
|
|
36
|
+
}
|
|
37
|
+
@media ${({ theme }) => theme.allBreakpoints('XL')} {
|
|
38
|
+
padding-left: ${spacing('xxl')};
|
|
39
|
+
padding-right: ${spacing('xxl')};
|
|
40
|
+
}
|
|
41
|
+
max-width: 1500px;
|
|
42
|
+
`;
|
|
43
|
+
|
|
44
|
+
const BgImage = styled(Picture)`
|
|
45
|
+
display: block;
|
|
46
|
+
position: absolute;
|
|
47
|
+
bottom: 0;
|
|
48
|
+
left: 0;
|
|
49
|
+
right: 0;
|
|
50
|
+
height: 100%;
|
|
51
|
+
`;
|
|
52
|
+
|
|
53
|
+
const Wrapper = styled.div`
|
|
54
|
+
position: relative;
|
|
55
|
+
text-align: center;
|
|
56
|
+
align-items: center;
|
|
57
|
+
display: block;
|
|
58
|
+
width: 100%;
|
|
59
|
+
|
|
60
|
+
${({ hasTopImage, shouldShowTitleSection }) => hasTopImage && !shouldShowTitleSection && css`
|
|
61
|
+
padding: 0;
|
|
62
|
+
`}
|
|
63
|
+
|
|
64
|
+
${({ noTitlesAtAll }) => noTitlesAtAll === true && css`
|
|
65
|
+
justify-content: center;
|
|
66
|
+
`};
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@media ${({ theme }) => theme.allBreakpoints('L')} {
|
|
70
|
+
display: flex;
|
|
71
|
+
padding: ${spacing('l')} ${spacing('md')};
|
|
72
|
+
gap: ${spacing('l')};
|
|
73
|
+
flex-direction: row;
|
|
74
|
+
}
|
|
75
|
+
`;
|
|
76
|
+
|
|
77
|
+
const TitleWrapperOuter = styled.div`
|
|
78
|
+
width: 100%;
|
|
79
|
+
display: flex;
|
|
80
|
+
font-family: ${({ theme }) => theme.fontFamilies(theme.font.regular)};
|
|
81
|
+
padding-bottom: ${spacing('l')};
|
|
82
|
+
@media ${({ theme }) => theme.allBreakpoints('L')} {
|
|
83
|
+
flex: 1 1 0;
|
|
84
|
+
width: auto;
|
|
85
|
+
padding: 0;
|
|
86
|
+
align-items: center;
|
|
87
|
+
order: ${({ donateOrientation }) => (donateOrientation === 'left' ? 2 : 1)};
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
90
|
+
|
|
91
|
+
const TitleWrapperInner = styled.div`
|
|
92
|
+
position: relative;
|
|
93
|
+
text-align: left;
|
|
94
|
+
`;
|
|
95
|
+
|
|
96
|
+
const FormWrapper = styled.div`
|
|
97
|
+
position: relative;
|
|
98
|
+
font-family: ${({ theme }) => theme.fontFamilies(theme.font.regular)};
|
|
99
|
+
@media ${({ theme }) => theme.allBreakpoints('L')} {
|
|
100
|
+
flex: 1 1 0;
|
|
101
|
+
min-width: 0;
|
|
102
|
+
width: auto;
|
|
103
|
+
display: flex;
|
|
104
|
+
justify-content: ${({ donateOrientation }) => (
|
|
105
|
+
donateOrientation === 'left' ? 'flex-start' : 'flex-end'
|
|
106
|
+
)};
|
|
107
|
+
order: ${({ donateOrientation }) => (donateOrientation === 'left' ? 1 : 2)};
|
|
108
|
+
}
|
|
109
|
+
`;
|
|
110
|
+
|
|
111
|
+
const Error = styled(Text)`
|
|
112
|
+
color: ${({ theme }) => theme.color('red')};
|
|
113
|
+
font-size: ${({ theme }) => theme.fontSize('s')};
|
|
114
|
+
font-weight: 500;
|
|
115
|
+
margin-top: ${spacing('l')};
|
|
116
|
+
`;
|
|
117
|
+
|
|
118
|
+
const Form = styled.form`
|
|
119
|
+
position: relative;
|
|
120
|
+
width: 100%;
|
|
121
|
+
background-color: ${({ theme }) => theme.color('white')};
|
|
122
|
+
box-shadow: 0px 0px 16px rgba(0, 0, 0, 0.15);
|
|
123
|
+
|
|
124
|
+
margin-left: auto;
|
|
125
|
+
margin-right: auto;
|
|
126
|
+
|
|
127
|
+
${({ hasTopImage, shouldShowTitleSection }) => hasTopImage && !shouldShowTitleSection && css`
|
|
128
|
+
margin-top: 0;
|
|
129
|
+
`}
|
|
130
|
+
|
|
131
|
+
h3 {
|
|
132
|
+
margin-top: ${spacing('md')};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
input {
|
|
136
|
+
max-width: 100%;
|
|
137
|
+
margin: 0;
|
|
138
|
+
}
|
|
139
|
+
input[type='submit'] {
|
|
140
|
+
margin: ${spacing('l')} 0;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
@media ${({ theme }) => theme.allBreakpoints('M')} {
|
|
144
|
+
width: 100%;
|
|
145
|
+
margin-right: auto;
|
|
146
|
+
margin-left: auto;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@media ${({ theme }) => theme.allBreakpoints('L')} {
|
|
150
|
+
margin-top: ${spacing('md')};
|
|
151
|
+
border-radius: 0.5rem;
|
|
152
|
+
max-width: 461px;
|
|
153
|
+
min-width: 400px;
|
|
154
|
+
/* Alignment is handled by the outer wrapper on desktop. */
|
|
155
|
+
margin-left: 0;
|
|
156
|
+
margin-right: 0;
|
|
157
|
+
}
|
|
158
|
+
`;
|
|
159
|
+
|
|
160
|
+
const OuterFieldset = styled.fieldset`
|
|
161
|
+
color: ${({ theme }) => theme.color('black')};
|
|
162
|
+
padding: 0 ${spacing('md')} ${spacing('md')};
|
|
163
|
+
margin: 0;
|
|
164
|
+
border: none;
|
|
165
|
+
@media ${({ theme }) => theme.allBreakpoints('M')} {
|
|
166
|
+
padding: 0 ${spacing('l')} ${spacing('l')};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
input[type='submit'] {
|
|
170
|
+
margin-bottom: 0;
|
|
171
|
+
}
|
|
172
|
+
`;
|
|
173
|
+
|
|
174
|
+
const Legend = styled.legend`
|
|
175
|
+
margin: 0;
|
|
176
|
+
padding: ${spacing('l')} ${spacing('sm')} 0 ${spacing('sm')};
|
|
177
|
+
display: block;
|
|
178
|
+
width: 100%;
|
|
179
|
+
`;
|
|
180
|
+
|
|
181
|
+
const PrimaryTitleText = styled(Text)`
|
|
182
|
+
display: block;
|
|
183
|
+
text-align: left;
|
|
184
|
+
font-size: ${({ theme }) => theme.fontSize('s')};
|
|
185
|
+
font-weight: 700;
|
|
186
|
+
`;
|
|
187
|
+
|
|
188
|
+
const SecondaryTitleText = styled(Text)`
|
|
189
|
+
display: block;
|
|
190
|
+
text-align: left;
|
|
191
|
+
font-size: ${({ theme }) => theme.fontSize('s')};
|
|
192
|
+
line-height: 1.5;
|
|
193
|
+
margin-top: ${spacing('sm')};
|
|
194
|
+
`;
|
|
195
|
+
|
|
196
|
+
const MoneyBuys = styled.div`
|
|
197
|
+
display: flex;
|
|
198
|
+
justify-content: space-between;
|
|
199
|
+
flex-direction: column;
|
|
200
|
+
margin-bottom: ${spacing('md')};
|
|
201
|
+
@media ${({ theme }) => theme.allBreakpoints('M')} {
|
|
202
|
+
flex-direction: row;
|
|
203
|
+
margin-top: ${spacing('m')};
|
|
204
|
+
}
|
|
205
|
+
label {
|
|
206
|
+
flex: 0 0 31%;
|
|
207
|
+
margin-bottom: ${spacing('sm')};
|
|
208
|
+
@media ${({ theme }) => theme.allBreakpoints('M')} {
|
|
209
|
+
margin-bottom: 0;
|
|
210
|
+
}
|
|
211
|
+
input {
|
|
212
|
+
cursor: pointer;
|
|
213
|
+
padding: ${spacing('sm')} ${spacing('m')};
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
`;
|
|
217
|
+
|
|
218
|
+
const FormFieldset = styled.div`
|
|
219
|
+
display: flex;
|
|
220
|
+
flex-direction: column;
|
|
221
|
+
align-items: flex-start;
|
|
222
|
+
justify-content: flex-start;
|
|
223
|
+
`;
|
|
224
|
+
|
|
225
|
+
const Label = styled(Text)`
|
|
226
|
+
margin-bottom: ${spacing('sm')};
|
|
227
|
+
`;
|
|
228
|
+
|
|
229
|
+
const AmountField = styled(Input)`
|
|
230
|
+
position: relative;
|
|
231
|
+
flex-basis: 50%;
|
|
232
|
+
flex-shrink: 0;
|
|
233
|
+
flex-grow: 0;
|
|
234
|
+
font-weight: 400;
|
|
235
|
+
display: block;
|
|
236
|
+
|
|
237
|
+
${({ $noMoneyBuys }) => $noMoneyBuys === true && css`
|
|
238
|
+
margin-top: ${spacing('sm')};
|
|
239
|
+
`}
|
|
240
|
+
|
|
241
|
+
@media ${({ theme }) => theme.allBreakpoints('M')} {
|
|
242
|
+
flex-basis: 60%;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
span {
|
|
246
|
+
position: absolute;
|
|
247
|
+
font-size: 20px;
|
|
248
|
+
top: 50%;
|
|
249
|
+
transform: translateY(-50%);
|
|
250
|
+
left: 0px;
|
|
251
|
+
font-weight: 500;
|
|
252
|
+
padding: 0px 15px;
|
|
253
|
+
${zIndex('high')};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
input {
|
|
257
|
+
height: 48px;
|
|
258
|
+
border: 1px solid ${({ theme }) => theme.color('grey')};
|
|
259
|
+
background: ${({ theme }) => theme.color('grey_light')};
|
|
260
|
+
border-radius: 0.5rem;
|
|
261
|
+
padding: ${spacing('sm')} ${spacing('md')} ${spacing('sm')} ${spacing('l')};
|
|
262
|
+
&:focus {
|
|
263
|
+
outline: none;
|
|
264
|
+
border: 1px solid ${({ theme }) => theme.color('grey')};
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
`;
|
|
268
|
+
|
|
269
|
+
const Copy = styled.p`
|
|
270
|
+
line-height: 1.5;
|
|
271
|
+
margin-top: ${spacing('l')};
|
|
272
|
+
color: ${({ theme }) => theme.color('black')};
|
|
273
|
+
`;
|
|
274
|
+
|
|
275
|
+
const Button = styled.button`
|
|
276
|
+
width: 100%;
|
|
277
|
+
margin: ${spacing('sm')} 0 ${spacing('sm')};
|
|
278
|
+
color: ${({ theme }) => theme.color('white')};
|
|
279
|
+
font-size: ${({ theme }) => theme.fontSize('s')};
|
|
280
|
+
font-weight: bold;
|
|
281
|
+
cursor: pointer;
|
|
282
|
+
min-height: 48px;
|
|
283
|
+
background: ${({ theme, color }) => theme.color(color)};
|
|
284
|
+
text-decoration: none;
|
|
285
|
+
border-radius: 0.5rem;
|
|
286
|
+
border: none;
|
|
287
|
+
appearance: none;
|
|
288
|
+
:active,
|
|
289
|
+
:focus,
|
|
290
|
+
:hover {
|
|
291
|
+
outline: none;
|
|
292
|
+
background-color: ${({ theme }) => theme.color('coral_dark')};
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
@media ${({ theme }) => theme.allBreakpoints('M')} {
|
|
296
|
+
padding: ${spacing('md')} ${spacing('l')};
|
|
297
|
+
}
|
|
298
|
+
`;
|
|
299
|
+
|
|
300
|
+
export {
|
|
301
|
+
BgImage,
|
|
302
|
+
Button,
|
|
303
|
+
Copy,
|
|
304
|
+
Container,
|
|
305
|
+
InnerContainer,
|
|
306
|
+
Error,
|
|
307
|
+
FormFieldset,
|
|
308
|
+
FormWrapper,
|
|
309
|
+
TitleWrapperInner,
|
|
310
|
+
TitleWrapperOuter,
|
|
311
|
+
Label,
|
|
312
|
+
Wrapper,
|
|
313
|
+
Form,
|
|
314
|
+
MoneyBuys,
|
|
315
|
+
AmountField,
|
|
316
|
+
OuterFieldset,
|
|
317
|
+
Legend,
|
|
318
|
+
PrimaryTitleText,
|
|
319
|
+
SecondaryTitleText
|
|
320
|
+
};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import 'jest-styled-components';
|
|
3
|
+
import renderWithTheme from '../../../../tests/hoc/shallowWithTheme';
|
|
4
|
+
import DonateBanner from './DonateBanner';
|
|
5
|
+
import data from './dev-data/data';
|
|
6
|
+
import singleData from './dev-data/data-single';
|
|
7
|
+
|
|
8
|
+
const defaultData = require('../../../styleguide/data/data').defaultData;
|
|
9
|
+
|
|
10
|
+
it('Monthly donation renders correctly', () => {
|
|
11
|
+
const imageL = {
|
|
12
|
+
images: defaultData.pictures.images,
|
|
13
|
+
imageLow: defaultData.pictures.imageLow,
|
|
14
|
+
alt: 'Background image'
|
|
15
|
+
};
|
|
16
|
+
const imageM = {
|
|
17
|
+
images: defaultData.pictures.images,
|
|
18
|
+
imageLow: defaultData.pictures.imageLow,
|
|
19
|
+
alt: 'Background image'
|
|
20
|
+
};
|
|
21
|
+
const imageS = {
|
|
22
|
+
images: defaultData.pictures.images,
|
|
23
|
+
imageLow: defaultData.pictures.imageLow,
|
|
24
|
+
alt: 'Background image'
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const tree = renderWithTheme(
|
|
28
|
+
<DonateBanner
|
|
29
|
+
pageBackgroundColour="grey_light"
|
|
30
|
+
paddingAbove="0rem"
|
|
31
|
+
paddingBelow="2rem"
|
|
32
|
+
donateOrientation="right"
|
|
33
|
+
imageL={imageL}
|
|
34
|
+
imageM={imageM}
|
|
35
|
+
imageS={imageS}
|
|
36
|
+
data={data}
|
|
37
|
+
mbshipID="mbship-1"
|
|
38
|
+
donateLink="https://donation.comicrelief.com/"
|
|
39
|
+
clientID="donate"
|
|
40
|
+
cartID="default-comicrelief"
|
|
41
|
+
title="Donate Now"
|
|
42
|
+
subtitle="Please help us fund life-changing projects in the UK and around the world."
|
|
43
|
+
/>
|
|
44
|
+
).toJSON();
|
|
45
|
+
|
|
46
|
+
expect(tree).toMatchSnapshot();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('Single donation renders correctly', () => {
|
|
50
|
+
const imageL = {
|
|
51
|
+
images: defaultData.pictures.images,
|
|
52
|
+
imageLow: defaultData.pictures.imageLow,
|
|
53
|
+
alt: 'Background image'
|
|
54
|
+
};
|
|
55
|
+
const imageM = {
|
|
56
|
+
images: defaultData.pictures.images,
|
|
57
|
+
imageLow: defaultData.pictures.imageLow,
|
|
58
|
+
alt: 'Background image'
|
|
59
|
+
};
|
|
60
|
+
const imageS = {
|
|
61
|
+
images: defaultData.pictures.images,
|
|
62
|
+
imageLow: defaultData.pictures.imageLow,
|
|
63
|
+
alt: 'Background image'
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const tree = renderWithTheme(
|
|
67
|
+
<DonateBanner
|
|
68
|
+
pageBackgroundColour="grey_light"
|
|
69
|
+
paddingAbove="2rem"
|
|
70
|
+
paddingBelow="2rem"
|
|
71
|
+
donateOrientation="left"
|
|
72
|
+
imageL={imageL}
|
|
73
|
+
imageM={imageM}
|
|
74
|
+
imageS={imageS}
|
|
75
|
+
data={singleData}
|
|
76
|
+
mbshipID="mbship-1"
|
|
77
|
+
donateLink="https://donation.comicrelief.com/"
|
|
78
|
+
clientID="donate"
|
|
79
|
+
cartID="default-comicrelief"
|
|
80
|
+
title="Donate Now"
|
|
81
|
+
subtitle="Please help us fund life-changing projects in the UK and around the world."
|
|
82
|
+
/>
|
|
83
|
+
).toJSON();
|
|
84
|
+
|
|
85
|
+
expect(tree).toMatchSnapshot();
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('Single donation with no Money Buys renders correctly', () => {
|
|
89
|
+
const imageL = {
|
|
90
|
+
images: defaultData.pictures.images,
|
|
91
|
+
imageLow: defaultData.pictures.imageLow,
|
|
92
|
+
alt: 'Background image'
|
|
93
|
+
};
|
|
94
|
+
const imageM = {
|
|
95
|
+
images: defaultData.pictures.images,
|
|
96
|
+
imageLow: defaultData.pictures.imageLow,
|
|
97
|
+
alt: 'Background image'
|
|
98
|
+
};
|
|
99
|
+
const imageS = {
|
|
100
|
+
images: defaultData.pictures.images,
|
|
101
|
+
imageLow: defaultData.pictures.imageLow,
|
|
102
|
+
alt: 'Background image'
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const tree = renderWithTheme(
|
|
106
|
+
<DonateBanner
|
|
107
|
+
pageBackgroundColour="grey_light"
|
|
108
|
+
paddingAbove="0rem"
|
|
109
|
+
paddingBelow="0rem"
|
|
110
|
+
donateOrientation="right"
|
|
111
|
+
imageL={imageL}
|
|
112
|
+
imageM={imageM}
|
|
113
|
+
imageS={imageS}
|
|
114
|
+
data={singleData}
|
|
115
|
+
mbshipID="mbship-1"
|
|
116
|
+
donateLink="https://donation.comicrelief.com/"
|
|
117
|
+
clientID="donate"
|
|
118
|
+
cartID="default-comicrelief"
|
|
119
|
+
title="Donate Now"
|
|
120
|
+
noMoneyBuys
|
|
121
|
+
subtitle="Please help us fund life-changing projects in the UK and around the world."
|
|
122
|
+
chooseAmountText="Overridden choose amount text"
|
|
123
|
+
/>
|
|
124
|
+
).toJSON();
|
|
125
|
+
|
|
126
|
+
expect(tree).toMatchSnapshot();
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('Text-only donate widget renders correctly', () => {
|
|
130
|
+
const tree = renderWithTheme(
|
|
131
|
+
<DonateBanner
|
|
132
|
+
donateWidgetIsTextOnly
|
|
133
|
+
pageBackgroundColour="grey_light"
|
|
134
|
+
componentBackgroundColour="deep_violet_dark"
|
|
135
|
+
paddingAbove="2rem"
|
|
136
|
+
paddingBelow="2rem"
|
|
137
|
+
donateOrientation="right"
|
|
138
|
+
data={data}
|
|
139
|
+
mbshipID="mbship-4"
|
|
140
|
+
donateLink="https://donation.comicrelief.com/"
|
|
141
|
+
clientID="donate"
|
|
142
|
+
cartID="default-comicrelief"
|
|
143
|
+
title="Donate Now"
|
|
144
|
+
noMoneyBuys
|
|
145
|
+
subtitle="Please help us fund life-changing projects in the UK and around the world."
|
|
146
|
+
chooseAmountText="Enter an amount to give"
|
|
147
|
+
/>
|
|
148
|
+
).toJSON();
|
|
149
|
+
|
|
150
|
+
expect(tree).toMatchSnapshot();
|
|
151
|
+
});
|