@comicrelief/component-library 8.55.0 → 8.55.2
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/dist/components/Molecules/HeroBanner/HeroBanner.style.js +68 -62
- package/dist/components/Molecules/HeroBanner/__snapshots__/HeroBanner.test.js.snap +7 -4
- package/dist/components/Organisms/DonateBanner/DonateBanner.js +12 -10
- package/dist/components/Organisms/DonateBanner/DonateBanner.md +24 -2
- package/dist/components/Organisms/DonateBanner/DonateBanner.style.js +34 -39
- package/dist/components/Organisms/DonateBanner/Form/Form.js +21 -26
- package/dist/components/Organisms/DonateBanner/GivingSelector/GivingSelector.js +1 -3
- package/dist/components/Organisms/DonateBanner/GivingSelector/GivingSelector.style.js +43 -7
- package/dist/components/Organisms/DonateBanner/MoneyBuy/MoneyBuy.js +20 -10
- package/dist/components/Organisms/DonateBanner/__snapshots__/DonateBanner.test.js.snap +355 -316
- package/dist/theme/shared/animations.js +9 -0
- package/package.json +1 -1
- package/src/components/Molecules/HeroBanner/HeroBanner.style.js +4 -3
- package/src/components/Molecules/HeroBanner/__snapshots__/HeroBanner.test.js.snap +7 -4
- package/src/components/Organisms/DonateBanner/DonateBanner.js +15 -11
- package/src/components/Organisms/DonateBanner/DonateBanner.md +24 -2
- package/src/components/Organisms/DonateBanner/DonateBanner.style.js +12 -12
- package/src/components/Organisms/DonateBanner/Form/Form.js +41 -32
- package/src/components/Organisms/DonateBanner/GivingSelector/GivingSelector.js +2 -4
- package/src/components/Organisms/DonateBanner/GivingSelector/GivingSelector.style.js +20 -3
- package/src/components/Organisms/DonateBanner/MoneyBuy/MoneyBuy.js +9 -1
- package/src/components/Organisms/DonateBanner/__snapshots__/DonateBanner.test.js.snap +355 -316
- package/src/theme/shared/animations.js +24 -1
|
@@ -123,9 +123,14 @@ const formFieldInputAnimation = (shiftPx = 4) => css`
|
|
|
123
123
|
* @param {boolean} animateScale - Whether to enable the scale animation
|
|
124
124
|
* @param {number} pixelMovement - Amount of movement to apply on hover
|
|
125
125
|
* @param {number} bounceIntensity - Intensity of the springy bounce effect (0-3, default: 1)
|
|
126
|
+
* @param {boolean} targetChild - Where to apply the transform
|
|
127
|
+
|
|
126
128
|
* @returns {css} template literal for the animation
|
|
127
129
|
*/
|
|
128
|
-
const bounceUpAnimation = (animateScale,
|
|
130
|
+
const bounceUpAnimation = (animateScale,
|
|
131
|
+
pixelMovement = 10,
|
|
132
|
+
bounceIntensity = 1,
|
|
133
|
+
targetChild = false) => {
|
|
129
134
|
if (!animateScale) {
|
|
130
135
|
return css``;
|
|
131
136
|
}
|
|
@@ -134,6 +139,24 @@ const bounceUpAnimation = (animateScale, pixelMovement = 10, bounceIntensity = 1
|
|
|
134
139
|
const overshoot = 1.55 + (bounceIntensity * 0.4);
|
|
135
140
|
const duration = 0.2 + (bounceIntensity * 0.1);
|
|
136
141
|
|
|
142
|
+
// The Hero Banner requires us to apply the transform inside
|
|
143
|
+
// the anchor, in order to address the 'infinity bounce' bug
|
|
144
|
+
if (targetChild) {
|
|
145
|
+
return css`
|
|
146
|
+
> div {
|
|
147
|
+
transition: transform ${duration}s cubic-bezier(0.68, ${pullBack}, 0.265, ${overshoot});
|
|
148
|
+
transform-origin: center;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
&:hover,
|
|
152
|
+
&:focus {
|
|
153
|
+
> div {
|
|
154
|
+
transform: translateY(-${pixelMovement}px);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
`;
|
|
158
|
+
}
|
|
159
|
+
|
|
137
160
|
return css`
|
|
138
161
|
transition: transform ${duration}s cubic-bezier(0.68, ${pullBack}, 0.265, ${overshoot});
|
|
139
162
|
transform-origin: center;
|