@comicrelief/component-library 7.12.2 → 7.13.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.
@@ -1,5 +1,655 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`"Single Giving, No Money Buys, with overridden manual input value" renders correctly 1`] = `
4
+ .c4 {
5
+ color: #FFFFFF;
6
+ font-size: 4rem;
7
+ line-height: 4rem;
8
+ text-transform: uppercase;
9
+ font-weight: normal;
10
+ font-family: 'Anton',Impact,sans-serif;
11
+ -webkit-letter-spacing: 0.03rem;
12
+ -moz-letter-spacing: 0.03rem;
13
+ -ms-letter-spacing: 0.03rem;
14
+ letter-spacing: 0.03rem;
15
+ }
16
+
17
+ .c5 {
18
+ color: #FFFFFF;
19
+ font-size: 1.25rem;
20
+ line-height: 1.25rem;
21
+ text-transform: inherit;
22
+ line-height: normal;
23
+ font-family: 'Montserrat',Helvetica,Arial,sans-serif;
24
+ font-size: 1rem;
25
+ }
26
+
27
+ .c16 {
28
+ font-size: 1.5rem;
29
+ line-height: 1.5rem;
30
+ text-transform: inherit;
31
+ font-weight: bold;
32
+ line-height: normal;
33
+ font-family: 'Montserrat',Helvetica,Arial,sans-serif;
34
+ }
35
+
36
+ .c20 {
37
+ font-size: 1rem;
38
+ line-height: 1rem;
39
+ text-transform: inherit;
40
+ font-weight: bold;
41
+ line-height: normal;
42
+ font-family: 'Montserrat',Helvetica,Arial,sans-serif;
43
+ }
44
+
45
+ .c18 {
46
+ position: relative;
47
+ display: -webkit-box;
48
+ display: -webkit-flex;
49
+ display: -ms-flexbox;
50
+ display: flex;
51
+ -webkit-flex-direction: column;
52
+ -ms-flex-direction: column;
53
+ flex-direction: column;
54
+ color: #5C5C5E;
55
+ width: 100%;
56
+ }
57
+
58
+ .c21 {
59
+ margin-bottom: 0.5rem;
60
+ }
61
+
62
+ .c23 {
63
+ position: relative;
64
+ box-sizing: border-box;
65
+ width: 100%;
66
+ height: 48px;
67
+ padding: 1rem 1.5rem;
68
+ background-color: #F4F3F5;
69
+ border: 1px solid;
70
+ border-color: #E1E2E3;
71
+ box-shadow: none;
72
+ -webkit-appearance: none;
73
+ -moz-appearance: none;
74
+ appearance: none;
75
+ color: #000000;
76
+ border-radius: 0.5rem;
77
+ font-size: inherit;
78
+ z-index: 2;
79
+ font-family: 'Montserrat',Helvetica,Arial,sans-serif;
80
+ }
81
+
82
+ .c23:focus {
83
+ border: 1px solid #666;
84
+ }
85
+
86
+ .c22 {
87
+ position: relative;
88
+ font-size: 1.25rem;
89
+ }
90
+
91
+ .c0 {
92
+ position: relative;
93
+ display: -webkit-box;
94
+ display: -webkit-flex;
95
+ display: -ms-flexbox;
96
+ display: flex;
97
+ -webkit-flex-direction: column;
98
+ -ms-flex-direction: column;
99
+ flex-direction: column;
100
+ -webkit-box-pack: center;
101
+ -webkit-justify-content: center;
102
+ -ms-flex-pack: center;
103
+ justify-content: center;
104
+ height: auto;
105
+ background-color: #274084;
106
+ }
107
+
108
+ .c1 {
109
+ position: relative;
110
+ text-align: center;
111
+ padding: 2rem 1rem;
112
+ -webkit-flex-direction: row;
113
+ -ms-flex-direction: row;
114
+ flex-direction: row;
115
+ -webkit-align-items: center;
116
+ -webkit-box-align: center;
117
+ -ms-flex-align: center;
118
+ align-items: center;
119
+ display: block;
120
+ width: 100%;
121
+ -webkit-flex-direction: row;
122
+ -ms-flex-direction: row;
123
+ flex-direction: row;
124
+ }
125
+
126
+ .c2 {
127
+ width: 100%;
128
+ display: -webkit-box;
129
+ display: -webkit-flex;
130
+ display: -ms-flexbox;
131
+ display: flex;
132
+ font-family: 'Montserrat',Helvetica,Arial,sans-serif;
133
+ }
134
+
135
+ .c3 {
136
+ position: relative;
137
+ text-align: left;
138
+ }
139
+
140
+ .c6 {
141
+ position: relative;
142
+ font-family: 'Montserrat',Helvetica,Arial,sans-serif;
143
+ }
144
+
145
+ .c13 {
146
+ position: relative;
147
+ width: 100%;
148
+ background-color: #FFFFFF;
149
+ box-shadow: 0px 0px 16px rgba(0,0,0,0.15);
150
+ border-radius: 10px;
151
+ margin-top: 1rem;
152
+ }
153
+
154
+ .c13 h3 {
155
+ margin-top: 1rem;
156
+ }
157
+
158
+ .c13 input {
159
+ max-width: 100%;
160
+ margin: 0;
161
+ }
162
+
163
+ .c13 input[type='submit'] {
164
+ margin: 2rem 0;
165
+ }
166
+
167
+ .c14 {
168
+ padding: 0 1rem 1rem;
169
+ margin: 0;
170
+ border: none;
171
+ }
172
+
173
+ .c14 input[type='submit'] {
174
+ margin-bottom: 0;
175
+ }
176
+
177
+ .c15 {
178
+ margin: 0;
179
+ padding: 2rem 0.5rem;
180
+ display: block;
181
+ width: 100%;
182
+ }
183
+
184
+ .c17 {
185
+ display: -webkit-box;
186
+ display: -webkit-flex;
187
+ display: -ms-flexbox;
188
+ display: flex;
189
+ -webkit-align-items: center;
190
+ -webkit-box-align: center;
191
+ -ms-flex-align: center;
192
+ align-items: center;
193
+ -webkit-box-pack: center;
194
+ -webkit-justify-content: center;
195
+ -ms-flex-pack: center;
196
+ justify-content: center;
197
+ }
198
+
199
+ .c19 {
200
+ position: relative;
201
+ -webkit-flex-basis: 50%;
202
+ -ms-flex-preferred-size: 50%;
203
+ flex-basis: 50%;
204
+ -webkit-flex-shrink: 0;
205
+ -ms-flex-negative: 0;
206
+ flex-shrink: 0;
207
+ -webkit-box-flex: 0;
208
+ -webkit-flex-grow: 0;
209
+ -ms-flex-positive: 0;
210
+ flex-grow: 0;
211
+ font-weight: 400;
212
+ display: block;
213
+ }
214
+
215
+ .c19 span {
216
+ position: absolute;
217
+ font-size: 20px;
218
+ top: 50%;
219
+ -webkit-transform: translateY(-50%);
220
+ -ms-transform: translateY(-50%);
221
+ transform: translateY(-50%);
222
+ left: 0px;
223
+ font-weight: 500;
224
+ padding: 0px 15px;
225
+ z-index: 3;
226
+ }
227
+
228
+ .c19 input {
229
+ height: 48px;
230
+ border: 2px solid #969598;
231
+ background: #F4F3F5;
232
+ border-radius: 10px;
233
+ padding: 0.5rem 1rem 0.5rem 2rem;
234
+ }
235
+
236
+ .c19 input:focus {
237
+ outline: none;
238
+ border: 2px solid #969598;
239
+ }
240
+
241
+ .c24 {
242
+ width: 100%;
243
+ margin: 2rem 0 2rem;
244
+ color: #FFFFFF;
245
+ font-size: 1rem;
246
+ font-weight: bold;
247
+ cursor: pointer;
248
+ min-height: 48px;
249
+ background: #E52630;
250
+ -webkit-text-decoration: none;
251
+ text-decoration: none;
252
+ border-radius: 2rem;
253
+ border: none;
254
+ box-shadow: 0px 0px 16px rgba(0,0,0,0.15);
255
+ -webkit-appearance: none;
256
+ -moz-appearance: none;
257
+ appearance: none;
258
+ }
259
+
260
+ .c24:active,
261
+ .c24:focus,
262
+ .c24:hover {
263
+ outline: none;
264
+ background-color: #961D35;
265
+ }
266
+
267
+ .c12 {
268
+ width: 50%;
269
+ height: 48px;
270
+ border-radius: 2rem;
271
+ z-index: 1;
272
+ display: block;
273
+ position: absolute;
274
+ -webkit-transition: left 0.15s ease-out;
275
+ transition: left 0.15s ease-out;
276
+ background-color: #0565D1;
277
+ left: 2px;
278
+ box-shadow: 0px 0px 16px rgba(0,0,0,0.3);
279
+ }
280
+
281
+ .c7 {
282
+ display: -webkit-box;
283
+ display: -webkit-flex;
284
+ display: -ms-flexbox;
285
+ display: flex;
286
+ margin: 1rem 0;
287
+ }
288
+
289
+ .c8 {
290
+ width: 100%;
291
+ padding: 2px;
292
+ position: relative;
293
+ display: -webkit-box;
294
+ display: -webkit-flex;
295
+ display: -ms-flexbox;
296
+ display: flex;
297
+ -webkit-flex-direction: row;
298
+ -ms-flex-direction: row;
299
+ flex-direction: row;
300
+ margin: 1rem 0;
301
+ border-radius: 2rem;
302
+ background: #BECCF9;
303
+ }
304
+
305
+ .c8 .give-monthly:checked ~ .c11 {
306
+ left: calc(50% - 2px);
307
+ }
308
+
309
+ .c8 input {
310
+ border: 0;
311
+ -webkit-clip: rect(0 0 0 0);
312
+ clip: rect(0 0 0 0);
313
+ -webkit-clip-path: inset(50%);
314
+ clip-path: inset(50%);
315
+ height: 1px;
316
+ margin: -1px;
317
+ overflow: hidden;
318
+ padding: 0;
319
+ position: absolute;
320
+ white-space: nowrap;
321
+ width: 1px;
322
+ }
323
+
324
+ .c8 input:focus:not(:checked) + label {
325
+ box-shadow: inset 0 0 0 4px #0565D1;
326
+ }
327
+
328
+ .c9 {
329
+ font-size: 1rem;
330
+ font-family: 'Montserrat',Helvetica,Arial,sans-serif;
331
+ font-weight: bold;
332
+ min-height: 48px;
333
+ -webkit-align-items: center;
334
+ -webkit-box-align: center;
335
+ -ms-flex-align: center;
336
+ align-items: center;
337
+ -webkit-box-pack: center;
338
+ -webkit-justify-content: center;
339
+ -ms-flex-pack: center;
340
+ justify-content: center;
341
+ display: -webkit-box;
342
+ display: -webkit-flex;
343
+ display: -ms-flexbox;
344
+ display: flex;
345
+ -webkit-flex-basis: 50%;
346
+ -ms-flex-preferred-size: 50%;
347
+ flex-basis: 50%;
348
+ border: none;
349
+ -webkit-transition: color 0.15s ease-out;
350
+ transition: color 0.15s ease-out;
351
+ z-index: 2;
352
+ cursor: default;
353
+ border-radius: 2rem;
354
+ color: #FFFFFF;
355
+ }
356
+
357
+ .c9:active:focus {
358
+ box-shadow: none;
359
+ }
360
+
361
+ .c9:focus {
362
+ border: none;
363
+ outline: none;
364
+ box-shadow: inset 0 0 0 4px #0565D1;
365
+ }
366
+
367
+ .c10 {
368
+ font-size: 1rem;
369
+ font-family: 'Montserrat',Helvetica,Arial,sans-serif;
370
+ font-weight: bold;
371
+ min-height: 48px;
372
+ -webkit-align-items: center;
373
+ -webkit-box-align: center;
374
+ -ms-flex-align: center;
375
+ align-items: center;
376
+ -webkit-box-pack: center;
377
+ -webkit-justify-content: center;
378
+ -ms-flex-pack: center;
379
+ justify-content: center;
380
+ display: -webkit-box;
381
+ display: -webkit-flex;
382
+ display: -ms-flexbox;
383
+ display: flex;
384
+ -webkit-flex-basis: 50%;
385
+ -ms-flex-preferred-size: 50%;
386
+ flex-basis: 50%;
387
+ border: none;
388
+ -webkit-transition: color 0.15s ease-out;
389
+ transition: color 0.15s ease-out;
390
+ z-index: 2;
391
+ cursor: pointer;
392
+ border-radius: 2rem;
393
+ color: #000000;
394
+ }
395
+
396
+ .c10:active:focus {
397
+ box-shadow: none;
398
+ }
399
+
400
+ .c10:focus {
401
+ border: none;
402
+ outline: none;
403
+ box-shadow: inset 0 0 0 4px #0565D1;
404
+ }
405
+
406
+ @media (min-width:740px) {
407
+ .c5 {
408
+ font-size: 1.25rem;
409
+ }
410
+ }
411
+
412
+ @media (min-width:740px) {
413
+ .c23 {
414
+ max-width: 290px;
415
+ }
416
+ }
417
+
418
+ @media (min-width:1024px) {
419
+ .c0 {
420
+ -webkit-flex-direction: row;
421
+ -ms-flex-direction: row;
422
+ flex-direction: row;
423
+ -webkit-align-items: center;
424
+ -webkit-box-align: center;
425
+ -ms-flex-align: center;
426
+ align-items: center;
427
+ -webkit-box-pack: inherit;
428
+ -webkit-justify-content: inherit;
429
+ -ms-flex-pack: inherit;
430
+ justify-content: inherit;
431
+ background-color: #274084;
432
+ }
433
+ }
434
+
435
+ @media (min-width:740px) {
436
+ .c1 {
437
+ padding: 4rem 1rem;
438
+ }
439
+ }
440
+
441
+ @media (min-width:1024px) {
442
+ .c1 {
443
+ display: -webkit-box;
444
+ display: -webkit-flex;
445
+ display: -ms-flexbox;
446
+ display: flex;
447
+ padding: 4rem 0;
448
+ }
449
+ }
450
+
451
+ @media (min-width:1024px) {
452
+ .c2 {
453
+ width: 50%;
454
+ padding: 4rem;
455
+ -webkit-align-items: center;
456
+ -webkit-box-align: center;
457
+ -ms-flex-align: center;
458
+ align-items: center;
459
+ }
460
+ }
461
+
462
+ @media (min-width:1024px) {
463
+ .c6 {
464
+ width: 50%;
465
+ }
466
+ }
467
+
468
+ @media (min-width:740px) {
469
+ .c13 {
470
+ width: 450px;
471
+ margin-right: auto;
472
+ margin-left: auto;
473
+ }
474
+ }
475
+
476
+ @media (min-width:740px) {
477
+ .c14 {
478
+ padding: 0 2rem 2rem;
479
+ }
480
+ }
481
+
482
+ @media (min-width:740px) {
483
+ .c19 {
484
+ -webkit-flex-basis: 60%;
485
+ -ms-flex-preferred-size: 60%;
486
+ flex-basis: 60%;
487
+ }
488
+ }
489
+
490
+ @media (min-width:740px) {
491
+ .c24 {
492
+ padding: 1rem 2rem;
493
+ }
494
+ }
495
+
496
+ @media (min-width:740px) {
497
+ .c8 {
498
+ width: 450px;
499
+ margin: 0 auto;
500
+ }
501
+ }
502
+
503
+ <div
504
+ className="c0"
505
+ id="mship-4"
506
+ >
507
+ <div
508
+ aria-live="polite"
509
+ className="c1"
510
+ >
511
+ <div
512
+ className="c2"
513
+ >
514
+ <div
515
+ className="c3"
516
+ >
517
+ <h2
518
+ className="c4"
519
+ color="white"
520
+ size="big"
521
+ >
522
+ Donate Now
523
+ </h2>
524
+ <p
525
+ className="c5"
526
+ color="white"
527
+ size="m"
528
+ >
529
+ Please help us fund life-changing projects in the UK and around the world.
530
+ </p>
531
+ </div>
532
+ </div>
533
+ <div
534
+ className="c6"
535
+ >
536
+ <div
537
+ className="c7"
538
+ >
539
+ <div
540
+ className="c8"
541
+ >
542
+ <input
543
+ aria-label="Single"
544
+ checked={true}
545
+ className="give-once"
546
+ errormsg=""
547
+ id="give-once--mship-4"
548
+ label=""
549
+ onClick={[Function]}
550
+ type="radio"
551
+ value="Single"
552
+ />
553
+ <label
554
+ className="c9"
555
+ htmlFor="give-once--mship-4"
556
+ >
557
+ Single
558
+ </label>
559
+ <input
560
+ aria-label="Monthly"
561
+ checked={false}
562
+ className="give-monthly"
563
+ errormsg=""
564
+ id="give-monthly--mship-4"
565
+ label=""
566
+ onClick={[Function]}
567
+ type="radio"
568
+ value="Monthly"
569
+ />
570
+ <label
571
+ className="c10"
572
+ htmlFor="give-monthly--mship-4"
573
+ >
574
+ Monthly
575
+ </label>
576
+ <span
577
+ className="c11 c12"
578
+ />
579
+ </div>
580
+ </div>
581
+ <form
582
+ className="c13"
583
+ onSubmit={[Function]}
584
+ >
585
+ <fieldset
586
+ className="c14"
587
+ >
588
+ <legend
589
+ className="c15"
590
+ >
591
+ <span
592
+ className="c16"
593
+ color="inherit"
594
+ size="l"
595
+ >
596
+ Enter an amount to give
597
+ </span>
598
+ </legend>
599
+ <div
600
+ className="c17"
601
+ >
602
+ <label
603
+ className="c18 c19"
604
+ htmlFor="mship-4--MoneyBuy-userInput"
605
+ >
606
+ <span
607
+ className="c20 c21"
608
+ color="inherit"
609
+ dangerouslySetInnerHTML={
610
+ Object {
611
+ "__html": "£",
612
+ }
613
+ }
614
+ size="s"
615
+ />
616
+ <div
617
+ className="c22"
618
+ >
619
+
620
+ <input
621
+ aria-describedby="mship-4--MoneyBuy-userInput"
622
+ aria-label="Input a different amount"
623
+ className="c23"
624
+ id="mship-4--MoneyBuy-userInput"
625
+ max="25000"
626
+ min="1"
627
+ name="membership_amount"
628
+ onChange={[Function]}
629
+ pattern="[^[0-9]+([,.][0-9]+)?$]"
630
+ placeholder="0.00"
631
+ required={false}
632
+ step="0.01"
633
+ type="number"
634
+ value="345.67"
635
+ />
636
+ </div>
637
+
638
+ </label>
639
+ </div>
640
+ <input
641
+ className="c24"
642
+ color="red"
643
+ type="submit"
644
+ value="Donate"
645
+ />
646
+ </fieldset>
647
+ </form>
648
+ </div>
649
+ </div>
650
+ </div>
651
+ `;
652
+
3
653
  exports[`Monthly donation renders correctly 1`] = `
4
654
  .c4 {
5
655
  color: #FFFFFF;
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": "7.12.2",
4
+ "version": "7.13.0",
5
5
  "main": "dist/index.js",
6
6
  "license": "ISC",
7
7
  "jest": {
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react';
1
+ import React, { useState, useEffect } from 'react';
2
2
  import { useMediaQuery } from 'react-responsive';
3
3
  import PropTypes from 'prop-types';
4
4
 
@@ -39,7 +39,8 @@ const Donate = ({
39
39
  noMoneyBuys,
40
40
  PopUpText,
41
41
  chooseAmountText,
42
- isDesktopOverride
42
+ isDesktopOverride,
43
+ otherAmountValue
43
44
  }) => {
44
45
  let isDesktop = useMediaQuery({ query: `(min-width: ${screen.medium})` });
45
46
 
@@ -47,7 +48,7 @@ const Donate = ({
47
48
  const [overrideValue, setOverrideValue] = useState(null);
48
49
 
49
50
  // Store the updated override value
50
- React.useEffect(() => {
51
+ useEffect(() => {
51
52
  setOverrideValue(isDesktopOverride);
52
53
  }, [isDesktopOverride]);
53
54
 
@@ -122,6 +123,7 @@ const Donate = ({
122
123
  PopUpText={PopUpText}
123
124
  chooseAmountText={chooseAmountText}
124
125
  submitButtonColor={submitButtonColor}
126
+ otherAmountValue={otherAmountValue}
125
127
  />
126
128
  </Wrapper>
127
129
  </Container>
@@ -153,7 +155,8 @@ Donate.propTypes = {
153
155
  noMoneyBuys: PropTypes.bool,
154
156
  PopUpText: PropTypes.string,
155
157
  chooseAmountText: PropTypes.string,
156
- isDesktopOverride: PropTypes.bool
158
+ isDesktopOverride: PropTypes.bool,
159
+ otherAmountValue: PropTypes.number
157
160
  };
158
161
 
159
162
  Donate.defaultProps = {
@@ -178,7 +181,8 @@ Donate.defaultProps = {
178
181
  noMoneyBuys: false,
179
182
  PopUpText: 'Help us deliver long-term impact by converting your single donation into a monthly gift.',
180
183
  chooseAmountText: '',
181
- isDesktopOverride: null
184
+ isDesktopOverride: null,
185
+ otherAmountValue: null
182
186
  };
183
187
 
184
188
  export default Donate;