@comicrelief/component-library 7.22.0 → 7.23.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 (221) hide show
  1. package/cypress/e2e/components/organisms/impactSlider.cy.js +72 -0
  2. package/dist/components/Atoms/Button/Button.js +4 -16
  3. package/dist/components/Atoms/Button/Button.test.js +0 -5
  4. package/dist/components/Atoms/ButtonWithStates/ButtonWithStates.js +14 -31
  5. package/dist/components/Atoms/Checkbox/Checkbox.js +4 -17
  6. package/dist/components/Atoms/Checkbox/Checkbox.test.js +0 -5
  7. package/dist/components/Atoms/Confetti/Confetti.js +8 -23
  8. package/dist/components/Atoms/Confetti/_TriggerConfetti.js +5 -13
  9. package/dist/components/Atoms/ErrorText/ErrorText.js +2 -14
  10. package/dist/components/Atoms/ErrorText/ErrorText.test.js +0 -5
  11. package/dist/components/Atoms/Icons/Arrow.js +7 -21
  12. package/dist/components/Atoms/Icons/AtSign.js +4 -14
  13. package/dist/components/Atoms/Icons/Chevron.js +7 -21
  14. package/dist/components/Atoms/Icons/Curve.js +1 -6
  15. package/dist/components/Atoms/Icons/Download.js +4 -14
  16. package/dist/components/Atoms/Icons/External.js +4 -14
  17. package/dist/components/Atoms/Icons/Favourite.js +4 -14
  18. package/dist/components/Atoms/Icons/Internal.js +4 -14
  19. package/dist/components/Atoms/Icons/index.js +14 -22
  20. package/dist/components/Atoms/Input/Input.js +15 -35
  21. package/dist/components/Atoms/Input/input.test.js +0 -5
  22. package/dist/components/Atoms/Label/Label.js +12 -24
  23. package/dist/components/Atoms/Link/Link.js +18 -35
  24. package/dist/components/Atoms/Link/Link.style.js +9 -25
  25. package/dist/components/Atoms/Link/Link.test.js +0 -6
  26. package/dist/components/Atoms/Logo/Logo.js +5 -22
  27. package/dist/components/Atoms/Logo/Logo.test.js +0 -5
  28. package/dist/components/Atoms/Pagination/Item/Item.js +3 -11
  29. package/dist/components/Atoms/Pagination/Item/Item.style.js +18 -30
  30. package/dist/components/Atoms/Pagination/List/List.js +10 -21
  31. package/dist/components/Atoms/Pagination/Pagination.js +25 -47
  32. package/dist/components/Atoms/Pagination/Pagination.test.js +0 -5
  33. package/dist/components/Atoms/Pagination/Utils/PaginationCalculator.js +14 -30
  34. package/dist/components/Atoms/Picture/Picture.js +19 -39
  35. package/dist/components/Atoms/Picture/Picture.test.js +0 -6
  36. package/dist/components/Atoms/RadioButton/RadioButton.js +6 -18
  37. package/dist/components/Atoms/RadioButton/RadioButton.test.js +0 -5
  38. package/dist/components/Atoms/RichText/RichText.js +4 -15
  39. package/dist/components/Atoms/RichText/RichText.test.js +0 -5
  40. package/dist/components/Atoms/Select/Select.js +19 -39
  41. package/dist/components/Atoms/Select/Select.test.js +0 -5
  42. package/dist/components/Atoms/SocialIcons/Icon/Icon.js +6 -18
  43. package/dist/components/Atoms/SocialIcons/SocialIcons.js +3 -17
  44. package/dist/components/Atoms/SocialIcons/SocialIcons.test.js +0 -5
  45. package/dist/components/Atoms/SocialIcons/Utils/Icons.js +2 -9
  46. package/dist/components/Atoms/SocialIcons/Utils/Links.js +2 -5
  47. package/dist/components/Atoms/Text/Text.js +16 -29
  48. package/dist/components/Atoms/Text/Text.test.js +0 -5
  49. package/dist/components/Atoms/TextArea/TextArea.js +10 -25
  50. package/dist/components/Atoms/TextArea/TextArea.test.js +0 -5
  51. package/dist/components/Atoms/TextInputWithDropdown/TextInputWithDropdown.js +26 -53
  52. package/dist/components/Atoms/TextInputWithDropdown/TextInputWithDropdown.style.js +8 -28
  53. package/dist/components/Atoms/TextInputWithDropdown/TextInputWithDropdown.test.js +0 -6
  54. package/dist/components/Molecules/Accordion/Accordion.js +8 -29
  55. package/dist/components/Molecules/Accordion/Accordion.test.js +0 -6
  56. package/dist/components/Molecules/ArticleTeaser/ArticleTeaser.js +14 -38
  57. package/dist/components/Molecules/ArticleTeaser/ArticleTeaser.test.js +0 -6
  58. package/dist/components/Molecules/Banner/Banner.js +3 -13
  59. package/dist/components/Molecules/Banner/Banner.test.js +0 -6
  60. package/dist/components/Molecules/Box/Box.js +9 -22
  61. package/dist/components/Molecules/Box/Box.test.js +0 -6
  62. package/dist/components/Molecules/Card/Card.js +11 -24
  63. package/dist/components/Molecules/Card/Card.test.js +0 -6
  64. package/dist/components/Molecules/CardDs/CardDs.js +17 -41
  65. package/dist/components/Molecules/CardDs/CardDs.test.js +0 -7
  66. package/dist/components/Molecules/Chip/Chip.js +4 -10
  67. package/dist/components/Molecules/Chip/Chip.style.js +8 -48
  68. package/dist/components/Molecules/Chip/Chip.test.js +0 -6
  69. package/dist/components/Molecules/Countdown/Countdown.js +17 -32
  70. package/dist/components/Molecules/Countdown/Countdown.style.js +4 -13
  71. package/dist/components/Molecules/Descriptor/Descriptor.js +6 -50
  72. package/dist/components/Molecules/Descriptor/Descriptor.test.js +0 -5
  73. package/dist/components/Molecules/DoubleCopy/DoubleCopy.js +2 -8
  74. package/dist/components/Molecules/DoubleCopy/DoubleCopy.style.js +4 -13
  75. package/dist/components/Molecules/DoubleCopy/DoubleCopy.test.js +0 -6
  76. package/dist/components/Molecules/HeroBanner/HeroBanner.js +4 -13
  77. package/dist/components/Molecules/InfoBanner/InfoBanner.js +8 -19
  78. package/dist/components/Molecules/InfoBanner/InfoBanner.test.js +0 -5
  79. package/dist/components/Molecules/Logos/Logos.js +1 -11
  80. package/dist/components/Molecules/Lookup/Lookup.js +25 -57
  81. package/dist/components/Molecules/PartnerLink/PartnerLink.js +3 -14
  82. package/dist/components/Molecules/PartnerLink/PartnerLink.style.js +4 -13
  83. package/dist/components/Molecules/PartnerLink/PartnerLink.test.js +0 -7
  84. package/dist/components/Molecules/Promo/Promo.js +43 -50
  85. package/dist/components/Molecules/Promo/Promo.md +18 -35
  86. package/dist/components/Molecules/Promo/Promo.style.js +23 -41
  87. package/dist/components/Molecules/Promo/Promo.test.js +0 -8
  88. package/dist/components/Molecules/Promo/_ProgressRing.js +7 -20
  89. package/dist/components/Molecules/Promo/_PromoVideo.js +42 -54
  90. package/dist/components/Molecules/Promo/_PromoVideoButton.js +5 -12
  91. package/dist/components/Molecules/Promo/_PromoVideoButton.style.js +33 -59
  92. package/dist/components/Molecules/Promo/__snapshots__/Promo.test.js.snap +116 -72
  93. package/dist/components/Molecules/SchoolLookup/SchoolLookup.js +6 -23
  94. package/dist/components/Molecules/SchoolLookup/SchoolLookup.test.js +0 -5
  95. package/dist/components/Molecules/SearchInput/SearchInput.js +4 -12
  96. package/dist/components/Molecules/SearchInput/SearchInput.style.js +7 -25
  97. package/dist/components/Molecules/SearchInput/SearchInput.test.js +0 -5
  98. package/dist/components/Molecules/SearchResult/SearchResult.js +11 -25
  99. package/dist/components/Molecules/SearchResult/SearchResult.test.js +0 -6
  100. package/dist/components/Molecules/ShareButton/ShareButton.js +10 -23
  101. package/dist/components/Molecules/ShareButton/ShareButton.style.js +6 -21
  102. package/dist/components/Molecules/ShareButton/ShareButton.test.js +0 -5
  103. package/dist/components/Molecules/ShareButton/assets/ShareIcons.js +1 -6
  104. package/dist/components/Molecules/SimpleSchoolLookup/SimpleSchoolLookup.js +4 -25
  105. package/dist/components/Molecules/SingleMessage/SingleMessage.js +48 -68
  106. package/dist/components/Molecules/SingleMessage/SingleMessage.style.js +19 -47
  107. package/dist/components/Molecules/SingleMessage/SingleMessage.test.js +0 -8
  108. package/dist/components/Molecules/SingleMessageDS/SingleMessageDs.js +22 -46
  109. package/dist/components/Molecules/SingleMessageDS/SingleMessageDs.style.js +13 -44
  110. package/dist/components/Molecules/SingleMessageDS/SingleMessageDs.test.js +0 -8
  111. package/dist/components/Molecules/Typeahead/Typeahead.js +25 -51
  112. package/dist/components/Molecules/Typeahead/Typeahead.test.js +0 -12
  113. package/dist/components/Molecules/VideoBanner/VideoBanner.js +14 -28
  114. package/dist/components/Molecules/VideoBanner/VideoBanner.test.js +0 -6
  115. package/dist/components/Organisms/CookieBanner/CookieBanner.js +3 -9
  116. package/dist/components/Organisms/CookieBanner/CookieBanner.style.js +6 -18
  117. package/dist/components/Organisms/CookieBanner/CookieBanner.test.js +0 -5
  118. package/dist/components/Organisms/Donate/Donate.js +36 -48
  119. package/dist/components/Organisms/Donate/Donate.style.js +23 -71
  120. package/dist/components/Organisms/Donate/Donate.test.js +0 -8
  121. package/dist/components/Organisms/Donate/Form/Form.js +53 -80
  122. package/dist/components/Organisms/Donate/Form/PopUpComponent.js +9 -27
  123. package/dist/components/Organisms/Donate/GivingSelector/GivingSelector.js +4 -12
  124. package/dist/components/Organisms/Donate/GivingSelector/GivingSelector.style.js +7 -25
  125. package/dist/components/Organisms/Donate/MoneyBuy/MoneyBuy.js +7 -21
  126. package/dist/components/Organisms/Donate/dev-data/data-high-value.js +2 -3
  127. package/dist/components/Organisms/Donate/dev-data/data-single.js +2 -3
  128. package/dist/components/Organisms/Donate/dev-data/data.js +2 -3
  129. package/dist/components/Organisms/EmailSignUp/EmailSignUp.style.js +12 -37
  130. package/dist/components/Organisms/EmailSignUp/EmailSignUp.test.js +0 -9
  131. package/dist/components/Organisms/EmailSignUp/EmailSignUpForm.js +3 -24
  132. package/dist/components/Organisms/EmailSignUp/_EmailSignUp.js +19 -32
  133. package/dist/components/Organisms/EmailSignUp/_EmailSignUpConfig.js +6 -18
  134. package/dist/components/Organisms/EmailSignUp/_TextInput.js +7 -16
  135. package/dist/components/Organisms/Footer/Footer.js +5 -17
  136. package/dist/components/Organisms/Footer/Footer.style.js +10 -35
  137. package/dist/components/Organisms/Footer/Footer.test.js +1 -7
  138. package/dist/components/Organisms/Footer/Nav/Nav.js +15 -39
  139. package/dist/components/Organisms/Footer/Nav/Nav.style.js +16 -37
  140. package/dist/components/Organisms/Footer/data/data.js +2 -3
  141. package/dist/components/Organisms/Footer/data/footerCopy.js +2 -3
  142. package/dist/components/Organisms/Header/Burger/BurgerMenu.js +3 -8
  143. package/dist/components/Organisms/Header/Burger/BurgerMenu.style.js +8 -19
  144. package/dist/components/Organisms/Header/Header.js +4 -14
  145. package/dist/components/Organisms/Header/Header.style.js +5 -22
  146. package/dist/components/Organisms/Header/Nav/Nav.js +19 -44
  147. package/dist/components/Organisms/Header/Nav/Nav.style.js +19 -46
  148. package/dist/components/Organisms/Header/data/data.js +2 -3
  149. package/dist/components/Organisms/Header/header.test.js +5 -2
  150. package/dist/components/Organisms/ImpactSlider/ImpactMoneybuys.style.js +61 -0
  151. package/dist/components/Organisms/ImpactSlider/ImpactSlider.js +71 -0
  152. package/dist/components/Organisms/ImpactSlider/ImpactSlider.md +42 -0
  153. package/dist/components/Organisms/ImpactSlider/ImpactSlider.style.js +56 -0
  154. package/dist/components/Organisms/ImpactSlider/Slider.style.js +30 -0
  155. package/dist/components/Organisms/ImpactSlider/_ImpactMoneybuys.js +42 -0
  156. package/dist/components/Organisms/ImpactSlider/_Slider.js +32 -0
  157. package/dist/components/Organisms/ImpactSlider/_utils.js +30 -0
  158. package/dist/components/Organisms/MarketingPreferencesDS/MarketingPreferencesDS.style.js +15 -54
  159. package/dist/components/Organisms/MarketingPreferencesDS/MarketingPreferencesDSForm.js +11 -20
  160. package/dist/components/Organisms/MarketingPreferencesDS/_AssociatedFields.js +1 -2
  161. package/dist/components/Organisms/MarketingPreferencesDS/_CheckAnswer.js +12 -23
  162. package/dist/components/Organisms/MarketingPreferencesDS/_DefaultCopy.js +4 -14
  163. package/dist/components/Organisms/MarketingPreferencesDS/_MarketingPreferencesDS.js +23 -35
  164. package/dist/components/Organisms/MarketingPreferencesDS/_MarketingPrefsConfig.js +10 -19
  165. package/dist/components/Organisms/MarketingPreferencesDS/_TextInput.js +7 -16
  166. package/dist/components/Organisms/Membership/Form/Form.js +50 -83
  167. package/dist/components/Organisms/Membership/Membership.js +13 -21
  168. package/dist/components/Organisms/Membership/Membership.style.js +21 -63
  169. package/dist/components/Organisms/Membership/Membership.test.js +0 -7
  170. package/dist/components/Organisms/Membership/MoneyBox/MoneyBox.js +9 -21
  171. package/dist/components/Organisms/Membership/dev-data/data.js +2 -3
  172. package/dist/hoc/shallowWithTheme.js +0 -6
  173. package/dist/index.js +134 -187
  174. package/dist/styleguide/CRLogo.js +1 -9
  175. package/dist/styleguide/StyleGuideRenderer.js +6 -10
  176. package/dist/styleguide/ThemeWrapper.js +1 -8
  177. package/dist/styleguide/data/data.js +20 -5
  178. package/dist/theme/ThemeProvider.js +1 -5
  179. package/dist/theme/crTheme/buttonColors.js +2 -11
  180. package/dist/theme/crTheme/colors.js +3 -9
  181. package/dist/theme/crTheme/fontSizes.js +2 -6
  182. package/dist/theme/crTheme/linkStyles.js +2 -11
  183. package/dist/theme/crTheme/theme.js +2 -11
  184. package/dist/theme/shared/breakpoint.js +4 -9
  185. package/dist/theme/shared/fontFamilies.js +2 -7
  186. package/dist/theme/shared/hideVisually.js +1 -4
  187. package/dist/theme/shared/size.js +5 -11
  188. package/dist/theme/shared/spacing.js +1 -5
  189. package/dist/theme/shared/zIndex.js +1 -8
  190. package/dist/theme/srTheme/buttonColors.js +2 -11
  191. package/dist/theme/srTheme/colors.js +3 -9
  192. package/dist/theme/srTheme/fontSizes.js +2 -6
  193. package/dist/theme/srTheme/linkStyles.js +2 -11
  194. package/dist/theme/srTheme/theme.js +2 -11
  195. package/dist/utils/Membership.js +11 -28
  196. package/dist/utils/ShareButton/sharePopUpHelper.js +3 -8
  197. package/dist/utils/ShareButton/shareTracking.js +1 -5
  198. package/dist/utils/ShareButton/shareUrlHelper.js +3 -5
  199. package/dist/utils/allowListed.js +1 -5
  200. package/dist/utils/allowListed.test.js +0 -2
  201. package/dist/utils/internalLinkHelper.js +11 -20
  202. package/dist/utils/navHelper.js +1 -6
  203. package/package.json +2 -1
  204. package/react-range-slider-input.d.ts +2 -0
  205. package/src/components/Molecules/Promo/Promo.js +14 -8
  206. package/src/components/Molecules/Promo/Promo.md +18 -35
  207. package/src/components/Molecules/Promo/Promo.style.js +28 -16
  208. package/src/components/Molecules/Promo/_PromoVideo.js +13 -8
  209. package/src/components/Molecules/Promo/_PromoVideoButton.js +1 -1
  210. package/src/components/Molecules/Promo/_PromoVideoButton.style.js +26 -21
  211. package/src/components/Molecules/Promo/__snapshots__/Promo.test.js.snap +116 -72
  212. package/src/components/Organisms/ImpactSlider/ImpactMoneybuys.style.js +96 -0
  213. package/src/components/Organisms/ImpactSlider/ImpactSlider.js +92 -0
  214. package/src/components/Organisms/ImpactSlider/ImpactSlider.md +42 -0
  215. package/src/components/Organisms/ImpactSlider/ImpactSlider.style.js +72 -0
  216. package/src/components/Organisms/ImpactSlider/Slider.style.js +70 -0
  217. package/src/components/Organisms/ImpactSlider/_ImpactMoneybuys.js +43 -0
  218. package/src/components/Organisms/ImpactSlider/_Slider.js +39 -0
  219. package/src/components/Organisms/ImpactSlider/_utils.js +32 -0
  220. package/src/index.js +1 -0
  221. package/src/styleguide/data/data.js +26 -1
@@ -4,6 +4,20 @@ import pauseWhite from './assets/Pause--white.svg';
4
4
  import playBlack from './assets/Play--black.svg';
5
5
  import pauseBlack from './assets/Pause--black.svg';
6
6
 
7
+ const PlayButtonWrapper = styled.div`
8
+ width: 100%;
9
+ height: 100%;
10
+ position: absolute;
11
+ top: 0;
12
+ left: 0;
13
+ z-index: 1;
14
+ &:after {
15
+ content: "";
16
+ // Preload all button icons
17
+ background-image: url(${playWhite}), url(${pauseWhite}), url(${playBlack}), url(${pauseBlack}), none;
18
+ }
19
+ `;
20
+
7
21
  const PlayButton = styled.button`
8
22
  display: flex;
9
23
  width: 50px;
@@ -17,8 +31,8 @@ const PlayButton = styled.button`
17
31
  padding: 0;
18
32
  margin: 0;
19
33
  border-radius: 50%;
20
- background: ${({ theme }) => theme.color('black')};
21
- opacity: 0.75;
34
+ background: ${({ theme }) => theme.color('white')};
35
+ opacity: 0.8;
22
36
  transition: opacity 0.2s;
23
37
 
24
38
  &:hover,
@@ -31,9 +45,8 @@ const PlayButton = styled.button`
31
45
  outline-width: medium;
32
46
  }
33
47
 
34
- // Non-light coloured video:
35
- ${({ lightColouredVideo }) => !lightColouredVideo && css`
36
- background: ${({ theme }) => theme.color('white')};
48
+ ${({ blackPlayButton }) => blackPlayButton && css`
49
+ background: ${({ theme }) => theme.color('black')};
37
50
  `}
38
51
 
39
52
  ${({ copyLeft }) => !copyLeft && css`
@@ -52,14 +65,6 @@ const PlayButton = styled.button`
52
65
  }
53
66
  `;
54
67
 
55
- const PlayButtonWrapper = styled.div`
56
- width: 100%;
57
- height: 100%;
58
- position: absolute;
59
- top: 0;
60
- left: 0;
61
- `;
62
-
63
68
  const ProgressRingWrapper = styled.span`
64
69
  position: absolute;
65
70
  width: 100%;
@@ -81,8 +86,8 @@ const ProgressRingCircle = styled.circle`
81
86
  stroke: white; // need to changed based on Promo settings
82
87
  fill: transparent;
83
88
 
84
- // Non-light coloured video, white button, black stroke
85
- ${({ lightColouredVideo }) => !lightColouredVideo && css`
89
+ // White button, black stroke
90
+ ${({ blackPlayButton }) => !blackPlayButton && css`
86
91
  stroke: ${({ theme }) => theme.color('black')};
87
92
  `}
88
93
 
@@ -97,21 +102,21 @@ const Icon = styled.span`
97
102
  width: 50px;
98
103
  background: no-repeat center/50% url(${playWhite}) transparent;
99
104
 
100
- // Light-coloured video, black button, white icons
101
- ${({ lightColouredVideo, isPlaying }) => (lightColouredVideo && !isPlaying) && css`
105
+ // Black button, white icons
106
+ ${({ blackPlayButton, isPlaying }) => (blackPlayButton && !isPlaying) && css`
102
107
  background-image: url(${playWhite});
103
108
  `}
104
109
 
105
- ${({ lightColouredVideo, isPlaying }) => (lightColouredVideo && isPlaying) && css`
110
+ ${({ blackPlayButton, isPlaying }) => (blackPlayButton && isPlaying) && css`
106
111
  background-image: url(${pauseWhite});
107
112
  `}
108
113
 
109
- // Non-light coloured video, white button, black icons
110
- ${({ lightColouredVideo, isPlaying }) => (!lightColouredVideo && !isPlaying) && css`
114
+ // White button, black icons
115
+ ${({ blackPlayButton, isPlaying }) => (!blackPlayButton && !isPlaying) && css`
111
116
  background-image: url(${playBlack});
112
117
  `}
113
118
 
114
- ${({ lightColouredVideo, isPlaying }) => (!lightColouredVideo && isPlaying) && css`
119
+ ${({ blackPlayButton, isPlaying }) => (!blackPlayButton && isPlaying) && css`
115
120
  background-image: url(${pauseBlack});
116
121
  `}
117
122
  `;
@@ -1,7 +1,7 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`renders Promo correctly 1`] = `
4
- .c6 {
4
+ .c7 {
5
5
  color: #FFFFFF;
6
6
  font-size: 5rem;
7
7
  line-height: 5rem;
@@ -16,7 +16,7 @@ exports[`renders Promo correctly 1`] = `
16
16
  line-height: 3rem;
17
17
  }
18
18
 
19
- .c7 {
19
+ .c8 {
20
20
  color: #FFFFFF;
21
21
  font-size: 1rem;
22
22
  line-height: 1rem;
@@ -39,7 +39,7 @@ exports[`renders Promo correctly 1`] = `
39
39
  object-fit: cover;
40
40
  }
41
41
 
42
- .c8 {
42
+ .c9 {
43
43
  display: -webkit-inline-box;
44
44
  display: -webkit-inline-flex;
45
45
  display: -ms-inline-flexbox;
@@ -68,7 +68,7 @@ exports[`renders Promo correctly 1`] = `
68
68
  color: #000000;
69
69
  }
70
70
 
71
- .c8:hover {
71
+ .c9:hover {
72
72
  background-color: #969598;
73
73
  color: #000000;
74
74
  }
@@ -102,13 +102,14 @@ exports[`renders Promo correctly 1`] = `
102
102
  -webkit-box-align: center;
103
103
  -ms-flex-align: center;
104
104
  align-items: center;
105
+ position: relative;
105
106
  -webkit-box-pack: end;
106
107
  -webkit-justify-content: flex-end;
107
108
  -ms-flex-pack: end;
108
109
  justify-content: flex-end;
109
110
  }
110
111
 
111
- .c5 {
112
+ .c6 {
112
113
  width: 100%;
113
114
  padding: 1.5rem 1.5rem 4rem;
114
115
  z-index: 1;
@@ -123,8 +124,21 @@ exports[`renders Promo correctly 1`] = `
123
124
  object-position: center;
124
125
  }
125
126
 
127
+ .c5 {
128
+ width: 100%;
129
+ height: 100%;
130
+ display: -webkit-box;
131
+ display: -webkit-flex;
132
+ display: -ms-flexbox;
133
+ display: flex;
134
+ -webkit-align-items: center;
135
+ -webkit-box-align: center;
136
+ -ms-flex-align: center;
137
+ align-items: center;
138
+ }
139
+
126
140
  @media (min-width:740px) {
127
- .c6 {
141
+ .c7 {
128
142
  font-size: 4rem;
129
143
  line-height: 4rem;
130
144
  margin-bottom: 2rem;
@@ -132,7 +146,7 @@ exports[`renders Promo correctly 1`] = `
132
146
  }
133
147
 
134
148
  @media (min-width:1024px) {
135
- .c6 {
149
+ .c7 {
136
150
  font-size: 5rem;
137
151
  line-height: 5rem;
138
152
  margin-bottom: 2rem;
@@ -140,7 +154,7 @@ exports[`renders Promo correctly 1`] = `
140
154
  }
141
155
 
142
156
  @media (min-width:740px) {
143
- .c8 {
157
+ .c9 {
144
158
  width: auto;
145
159
  }
146
160
  }
@@ -160,23 +174,27 @@ exports[`renders Promo correctly 1`] = `
160
174
  }
161
175
 
162
176
  @media (min-width:1024px) {
163
- .c5 {
164
- width: 70%;
165
- padding: 4rem 1.5rem;
177
+ .c6 {
178
+ width: 100%;
179
+ padding: 8rem 1.5rem;
166
180
  }
167
181
  }
168
182
 
169
183
  @media (min-width:1024px) {
170
- .c5 {
171
- width: 50%;
172
- padding: 8rem 1.5rem;
184
+ .c1 {
185
+ height: 100%;
186
+ position: absolute;
173
187
  }
174
188
  }
175
189
 
176
190
  @media (min-width:1024px) {
177
- .c1 {
178
- height: 100%;
191
+ .c5 {
192
+ width: 50%;
179
193
  position: absolute;
194
+ top: 0;
195
+ left: 0;
196
+ left: auto;
197
+ right: 0;
180
198
  }
181
199
  }
182
200
 
@@ -211,38 +229,42 @@ exports[`renders Promo correctly 1`] = `
211
229
  <div
212
230
  className="c5"
213
231
  >
214
- <h1
232
+ <div
215
233
  className="c6"
216
- color="white"
217
- size="super"
218
- >
219
- Curabitur pretium tincidunt lacus
220
- </h1>
221
- <p
222
- className="c7"
223
- color="white"
224
- size="s"
225
234
  >
226
- Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius, turpis et commodo, est eros bibendum elit, nec luctus magna sollicitudin.
227
- </p>
228
- <span>
229
- <a
235
+ <h1
236
+ className="c7"
237
+ color="white"
238
+ size="super"
239
+ >
240
+ Curabitur pretium tincidunt lacus
241
+ </h1>
242
+ <p
230
243
  className="c8"
231
244
  color="white"
232
- href="/"
233
- target="_self"
234
- type="button"
245
+ size="s"
235
246
  >
236
- Show me this
237
- </a>
238
- </span>
247
+ Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius, turpis et commodo, est eros bibendum elit, nec luctus magna sollicitudin.
248
+ </p>
249
+ <span>
250
+ <a
251
+ className="c9"
252
+ color="white"
253
+ href="/"
254
+ target="_self"
255
+ type="button"
256
+ >
257
+ Show me this
258
+ </a>
259
+ </span>
260
+ </div>
239
261
  </div>
240
262
  </div>
241
263
  </div>
242
264
  `;
243
265
 
244
266
  exports[`renders Promo correctly end position 1`] = `
245
- .c6 {
267
+ .c7 {
246
268
  color: #FFFFFF;
247
269
  font-size: 5rem;
248
270
  line-height: 5rem;
@@ -257,7 +279,7 @@ exports[`renders Promo correctly end position 1`] = `
257
279
  line-height: 3rem;
258
280
  }
259
281
 
260
- .c7 {
282
+ .c8 {
261
283
  color: #FFFFFF;
262
284
  font-size: 1rem;
263
285
  line-height: 1rem;
@@ -280,7 +302,7 @@ exports[`renders Promo correctly end position 1`] = `
280
302
  object-fit: cover;
281
303
  }
282
304
 
283
- .c8 {
305
+ .c9 {
284
306
  display: -webkit-inline-box;
285
307
  display: -webkit-inline-flex;
286
308
  display: -ms-inline-flexbox;
@@ -309,7 +331,7 @@ exports[`renders Promo correctly end position 1`] = `
309
331
  color: #000000;
310
332
  }
311
333
 
312
- .c8:hover {
334
+ .c9:hover {
313
335
  background-color: #969598;
314
336
  color: #000000;
315
337
  }
@@ -346,13 +368,14 @@ exports[`renders Promo correctly end position 1`] = `
346
368
  -webkit-box-align: center;
347
369
  -ms-flex-align: center;
348
370
  align-items: center;
371
+ position: relative;
349
372
  -webkit-box-pack: end;
350
373
  -webkit-justify-content: flex-end;
351
374
  -ms-flex-pack: end;
352
375
  justify-content: flex-end;
353
376
  }
354
377
 
355
- .c5 {
378
+ .c6 {
356
379
  width: 100%;
357
380
  padding: 1.5rem 1.5rem 4rem;
358
381
  z-index: 1;
@@ -367,8 +390,21 @@ exports[`renders Promo correctly end position 1`] = `
367
390
  object-position: center;
368
391
  }
369
392
 
393
+ .c5 {
394
+ width: 100%;
395
+ height: 100%;
396
+ display: -webkit-box;
397
+ display: -webkit-flex;
398
+ display: -ms-flexbox;
399
+ display: flex;
400
+ -webkit-align-items: center;
401
+ -webkit-box-align: center;
402
+ -ms-flex-align: center;
403
+ align-items: center;
404
+ }
405
+
370
406
  @media (min-width:740px) {
371
- .c6 {
407
+ .c7 {
372
408
  font-size: 4rem;
373
409
  line-height: 4rem;
374
410
  margin-bottom: 2rem;
@@ -376,7 +412,7 @@ exports[`renders Promo correctly end position 1`] = `
376
412
  }
377
413
 
378
414
  @media (min-width:1024px) {
379
- .c6 {
415
+ .c7 {
380
416
  font-size: 5rem;
381
417
  line-height: 5rem;
382
418
  margin-bottom: 2rem;
@@ -384,7 +420,7 @@ exports[`renders Promo correctly end position 1`] = `
384
420
  }
385
421
 
386
422
  @media (min-width:740px) {
387
- .c8 {
423
+ .c9 {
388
424
  width: auto;
389
425
  }
390
426
  }
@@ -412,23 +448,27 @@ exports[`renders Promo correctly end position 1`] = `
412
448
  }
413
449
 
414
450
  @media (min-width:1024px) {
415
- .c5 {
416
- width: 70%;
417
- padding: 4rem 1.5rem;
451
+ .c6 {
452
+ width: 100%;
453
+ padding: 8rem 1.5rem;
418
454
  }
419
455
  }
420
456
 
421
457
  @media (min-width:1024px) {
422
- .c5 {
423
- width: 50%;
424
- padding: 8rem 1.5rem;
458
+ .c1 {
459
+ height: 100%;
460
+ position: absolute;
425
461
  }
426
462
  }
427
463
 
428
464
  @media (min-width:1024px) {
429
- .c1 {
430
- height: 100%;
465
+ .c5 {
466
+ width: 50%;
431
467
  position: absolute;
468
+ top: 0;
469
+ left: 0;
470
+ left: auto;
471
+ right: 0;
432
472
  }
433
473
  }
434
474
 
@@ -463,31 +503,35 @@ exports[`renders Promo correctly end position 1`] = `
463
503
  <div
464
504
  className="c5"
465
505
  >
466
- <h1
506
+ <div
467
507
  className="c6"
468
- color="white"
469
- size="super"
470
- >
471
- Curabitur pretium tincidunt lacus
472
- </h1>
473
- <p
474
- className="c7"
475
- color="white"
476
- size="s"
477
508
  >
478
- Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius, turpis et commodo, est eros bibendum elit, nec luctus magna sollicitudin.
479
- </p>
480
- <span>
481
- <a
509
+ <h1
510
+ className="c7"
511
+ color="white"
512
+ size="super"
513
+ >
514
+ Curabitur pretium tincidunt lacus
515
+ </h1>
516
+ <p
482
517
  className="c8"
483
518
  color="white"
484
- href="/"
485
- target="_self"
486
- type="button"
519
+ size="s"
487
520
  >
488
- Show me this
489
- </a>
490
- </span>
521
+ Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius, turpis et commodo, est eros bibendum elit, nec luctus magna sollicitudin.
522
+ </p>
523
+ <span>
524
+ <a
525
+ className="c9"
526
+ color="white"
527
+ href="/"
528
+ target="_self"
529
+ type="button"
530
+ >
531
+ Show me this
532
+ </a>
533
+ </span>
534
+ </div>
491
535
  </div>
492
536
  </div>
493
537
  </div>
@@ -0,0 +1,96 @@
1
+ import styled, { css } from 'styled-components';
2
+ import Text from '../../Atoms/Text/Text';
3
+
4
+ const MoneybuyWrapper = styled.div`
5
+ margin-top: 32px;
6
+ width: 100%;
7
+ display: flex;
8
+ align-content: space-between;
9
+ flex-direction: column;
10
+ justify-content: space-between;
11
+ align-items: center;
12
+
13
+ @media ${({ theme }) => theme.breakpoint('medium')} {
14
+ flex-direction: row;
15
+ align-items: stretch;
16
+ }
17
+ `;
18
+
19
+ const Moneybuy = styled.div`
20
+ display: inherit;
21
+ width: 100%;
22
+ padding: 8px 20px;
23
+ height: auto;
24
+ background-color: white;
25
+ border-radius: 10px;
26
+ border: 1px solid ${props => props.theme.color('black')};;
27
+ position: relative;
28
+ flex-direction: row;
29
+ align-items: center;
30
+ justify-content: flex-start;
31
+ opacity: 1;
32
+
33
+ ${props => props.isInactive && css`
34
+ opacity: 0.5;
35
+ `}
36
+
37
+ @media ${({ theme }) => theme.breakpoint('small')} {
38
+ width: 70%;
39
+ padding: 8px 40px;
40
+
41
+ }
42
+
43
+ @media ${({ theme }) => theme.breakpoint('medium')} {
44
+ padding: 20px 14px;
45
+ flex-direction: column;
46
+ width: 18%;
47
+ max-height: none;
48
+ }
49
+ `;
50
+
51
+ const OrLabel = styled(Text)`
52
+ display: inherit;
53
+ align-items: center;
54
+ margin: 8px 0;
55
+ font-size: 14px;
56
+ `;
57
+
58
+ const MoneybuyImage = styled.span`
59
+ background: center / 65% no-repeat url("${props => props.imageURL}"),
60
+ ${props => props.theme.color('grey_extra_light')};
61
+ width: 48px;
62
+ height: 48px;
63
+ border-radius: 48px;
64
+
65
+ @media ${({ theme }) => theme.breakpoint('medium')} {
66
+ width: 0;
67
+ height: 0;
68
+ padding: 30%;
69
+ border-radius: 100%;
70
+ }
71
+ `;
72
+
73
+ const MoneybuyAmount = styled(Text)`
74
+ text-align: center;
75
+ margin: 0 10px;
76
+ width: 25%;
77
+
78
+ @media ${({ theme }) => theme.breakpoint('medium')} {
79
+ margin: 8px 15px 2px;
80
+ width: auto;
81
+ }
82
+ `;
83
+
84
+ const MoneybuyDescription = styled(Text)`
85
+ text-align: left;
86
+ width: 50%;
87
+
88
+ @media ${({ theme }) => theme.breakpoint('medium')} {
89
+ width: 100%;
90
+ text-align: center;
91
+ }
92
+ `;
93
+
94
+ export {
95
+ MoneybuyWrapper, Moneybuy, OrLabel, MoneybuyImage, MoneybuyAmount, MoneybuyDescription
96
+ };
@@ -0,0 +1,92 @@
1
+ import React, { useState } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import Text from '../../Atoms/Text/Text';
4
+ import Slider from './_Slider';
5
+ import Moneybuys from './_ImpactMoneybuys';
6
+ import handleSubmission from './_utils';
7
+
8
+ import {
9
+ OuterWrapper, InnerWrapper, Copy, CurrentAmountCopy, SubmitButton
10
+ } from './ImpactSlider.style';
11
+
12
+ const ImpactSlider = ({
13
+ heading, cartID, donateLink, rowID, items, step,
14
+ max, opacityAnimation, children, defaultSliderValue
15
+ }) => {
16
+ // Use the lowest possible amount as our default:
17
+ const [currentAmount, setCurrentAmount] = useState(defaultSliderValue || step);
18
+
19
+ const handleChange = thisValue => {
20
+ if (thisValue) {
21
+ // Return the value of the 'thumb' we care about:
22
+ setCurrentAmount(thisValue[1]);
23
+ }
24
+ };
25
+
26
+ const handleSubmit = () => {
27
+ handleSubmission(currentAmount, donateLink, cartID, rowID);
28
+ };
29
+
30
+ return (
31
+ <OuterWrapper>
32
+ <InnerWrapper>
33
+ <Text tag="h1" family="Anton" uppercase weight="normal" size="xl">{heading}</Text>
34
+ <Copy>
35
+ {children}
36
+ </Copy>
37
+ <CurrentAmountCopy tag="p" size="s">
38
+ A donation of
39
+ {' '}
40
+ £
41
+ {currentAmount}
42
+ {' '}
43
+ could help pay for:
44
+ </CurrentAmountCopy>
45
+ <Slider
46
+ currentAmount={currentAmount}
47
+ min={step}
48
+ max={max}
49
+ handleChange={handleChange}
50
+ steps={step}
51
+ />
52
+ <Moneybuys
53
+ items={items}
54
+ currentAmount={currentAmount}
55
+ opacityAnimation={opacityAnimation}
56
+ />
57
+ <SubmitButton type="submit" onClick={handleSubmit} disabled={currentAmount === 0}>
58
+ Donate £
59
+ {currentAmount}
60
+ {' '}
61
+ now
62
+ </SubmitButton>
63
+ </InnerWrapper>
64
+ </OuterWrapper>
65
+ );
66
+ };
67
+
68
+ ImpactSlider.defaultProps = {
69
+ opacityAnimation: false,
70
+ defaultSliderValue: null
71
+ };
72
+
73
+ ImpactSlider.propTypes = {
74
+ heading: PropTypes.string.isRequired,
75
+ children: PropTypes.node.isRequired,
76
+ cartID: PropTypes.string.isRequired,
77
+ donateLink: PropTypes.string.isRequired,
78
+ rowID: PropTypes.string.isRequired,
79
+ step: PropTypes.number.isRequired,
80
+ max: PropTypes.number.isRequired,
81
+ defaultSliderValue: PropTypes.number,
82
+ opacityAnimation: PropTypes.bool,
83
+ items: PropTypes.arrayOf(
84
+ PropTypes.shape({
85
+ poundsPerItem: PropTypes.number.isRequired,
86
+ description: PropTypes.string.isRequired,
87
+ imageURL: PropTypes.string.isRequired
88
+ })
89
+ ).isRequired
90
+ };
91
+
92
+ export default ImpactSlider;
@@ -0,0 +1,42 @@
1
+ # Impact Slider (w/opacity animation)
2
+
3
+ ```js
4
+ const { testImpactSliderItems} = require('../../../styleguide/data/data');
5
+ import Text from '../../Atoms/Text/Text';
6
+
7
+ <ImpactSlider
8
+ heading="Your donations will change lives"
9
+ donateLink="https://donation-staging.spa.comicrelief.com"
10
+ rowID="to-come-from-the-cms"
11
+ cartID="to-also-come-from-the-cms"
12
+ items={testImpactSliderItems}
13
+ step={5}
14
+ max={100}
15
+ opacityAnimation={true}
16
+ >
17
+ <Text tag="p" color="black">
18
+ Use this slider to see how your donation can make a difference to lives in the UK and around the globe this winter.
19
+ </Text>
20
+ </ImpactSlider>
21
+ ```
22
+
23
+ # Impact Slider (w/o opacity animation, w/default value)
24
+ ```js
25
+ const { testImpactSliderItems} = require('../../../styleguide/data/data');
26
+ import Text from '../../Atoms/Text/Text';
27
+
28
+ <ImpactSlider
29
+ heading="Your donations will change lives"
30
+ donateLink="https://donation-staging.spa.comicrelief.com"
31
+ rowID="to-come-from-the-cms"
32
+ cartID="to-also-come-from-the-cms"
33
+ items={testImpactSliderItems}
34
+ step={5}
35
+ max={100}
36
+ defaultSliderValue={45}
37
+ >
38
+ <Text tag="p" color="black">
39
+ Use this slider to see how your donation can make a difference to lives in the UK and around the globe this winter.
40
+ </Text>
41
+ </ImpactSlider>
42
+ ```