@comicrelief/component-library 8.77.5 → 8.77.6
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/index.cjs.js +625 -611
- package/dist/index.es.js +4547 -4531
- package/package.json +1 -1
- package/src/components/Molecules/CTA/CTAMultiCard/__snapshots__/CTAMultiCard.test.js.snap +1008 -1035
- package/src/components/Molecules/CTA/CTASingleCard/__snapshots__/CTASingleCard.test.js.snap +232 -196
- package/src/components/Molecules/CTA/shared/CTACard.js +15 -13
- package/src/components/Molecules/CTA/shared/CTACard.style.js +32 -15
|
@@ -17,7 +17,8 @@ import {
|
|
|
17
17
|
ArrowIconOuter,
|
|
18
18
|
ArrowIconInner,
|
|
19
19
|
ArrowIconWrapper,
|
|
20
|
-
CardWrapper
|
|
20
|
+
CardWrapper,
|
|
21
|
+
CardLinkContent
|
|
21
22
|
} from './CTACard.style';
|
|
22
23
|
|
|
23
24
|
const CTACard = ({
|
|
@@ -52,7 +53,6 @@ const CTACard = ({
|
|
|
52
53
|
$isCarousel={isCarousel}
|
|
53
54
|
$isFullWidth={effectiveIsFullWidth}
|
|
54
55
|
$columns={columns}
|
|
55
|
-
$hasLink={hasLink}
|
|
56
56
|
>
|
|
57
57
|
<CardLink
|
|
58
58
|
as={hasLink ? Link : 'div'}
|
|
@@ -61,7 +61,8 @@ const CTACard = ({
|
|
|
61
61
|
$isSingleCard={isSingleCard}
|
|
62
62
|
$hasLink={hasLink}
|
|
63
63
|
>
|
|
64
|
-
|
|
64
|
+
<CardLinkContent>
|
|
65
|
+
{imageLow && (
|
|
65
66
|
<ImageWrapper $isSingleCard={isSingleCard}>
|
|
66
67
|
<Picture
|
|
67
68
|
alt={description}
|
|
@@ -73,17 +74,17 @@ const CTACard = ({
|
|
|
73
74
|
height="100%"
|
|
74
75
|
/>
|
|
75
76
|
</ImageWrapper>
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
)}
|
|
78
|
+
<CopyAndLinkSection $isSingleCard={isSingleCard}>
|
|
79
|
+
<Copy>
|
|
80
|
+
{isSingleCard && label && (
|
|
80
81
|
<CardLabel>
|
|
81
82
|
{label}
|
|
82
83
|
</CardLabel>
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
)}
|
|
85
|
+
{body}
|
|
86
|
+
</Copy>
|
|
87
|
+
{linkLabel && (
|
|
87
88
|
<CTA>
|
|
88
89
|
<CTAText>
|
|
89
90
|
{linkLabel}
|
|
@@ -101,8 +102,9 @@ const CTACard = ({
|
|
|
101
102
|
</ArrowIconWrapper>
|
|
102
103
|
</ArrowIconOuter>
|
|
103
104
|
</CTA>
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
)}
|
|
106
|
+
</CopyAndLinkSection>
|
|
107
|
+
</CardLinkContent>
|
|
106
108
|
</CardLink>
|
|
107
109
|
</CardWrapper>
|
|
108
110
|
);
|
|
@@ -66,6 +66,16 @@ const CTAText = styled.span`
|
|
|
66
66
|
}
|
|
67
67
|
`;
|
|
68
68
|
|
|
69
|
+
const CardLinkContent = styled.div`
|
|
70
|
+
display: inherit;
|
|
71
|
+
flex-direction: inherit;
|
|
72
|
+
flex: inherit;
|
|
73
|
+
border-radius: inherit;
|
|
74
|
+
overflow: hidden;
|
|
75
|
+
transition: box-shadow 0.35s;
|
|
76
|
+
${defaultBoxShadow()}
|
|
77
|
+
`;
|
|
78
|
+
|
|
69
79
|
// Card wrapper link - makes entire card clickable
|
|
70
80
|
const CardLink = styled.a`
|
|
71
81
|
display: flex;
|
|
@@ -75,17 +85,18 @@ const CardLink = styled.a`
|
|
|
75
85
|
flex: 1 1 auto;
|
|
76
86
|
background: transparent;
|
|
77
87
|
border-radius: 1rem;
|
|
78
|
-
transition: box-shadow 0.35s;
|
|
79
|
-
${defaultBoxShadow()}
|
|
80
88
|
text-decoration: none;
|
|
81
|
-
overflow: hidden;
|
|
82
89
|
cursor: ${({ $hasLink }) => ($hasLink ? 'pointer' : 'default')};
|
|
83
90
|
box-sizing: border-box;
|
|
84
91
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
92
|
+
${({ $hasLink }) => $hasLink && css`
|
|
93
|
+
&:hover,
|
|
94
|
+
&:focus {
|
|
95
|
+
${CardLinkContent} {
|
|
96
|
+
${defaultBoxShadow(true)}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
`};
|
|
89
100
|
|
|
90
101
|
// Side-by-side layout for single card desktop view
|
|
91
102
|
${({ $isSingleCard }) => $isSingleCard && css`
|
|
@@ -132,10 +143,19 @@ const CardLink = styled.a`
|
|
|
132
143
|
|
|
133
144
|
// Desktop-only hover/focus effects
|
|
134
145
|
@media ${({ theme }) => theme.allBreakpoints('L')} {
|
|
146
|
+
|
|
147
|
+
// Allow the nested content and its box-shadow to be completely visible when it's animated upwards:
|
|
148
|
+
overflow: visible;
|
|
135
149
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
150
|
+
// Using the 4th, optional 'target child' parameter to target CardLinkContent for the position animation
|
|
151
|
+
// rather than *this* element, to ensure we don't end up with that infinite bounce bug.
|
|
152
|
+
${bounceUpAnimation(true, 10, 2, true)};
|
|
153
|
+
|
|
154
|
+
/* Override the transition initially set by bounceUpAnimation (targetting the same child) to tweaked some values,
|
|
155
|
+
while also ensuring we don't lose the previously-added box-shadow animation by re-adding it here: */
|
|
156
|
+
> ${CardLinkContent} {
|
|
157
|
+
transition: transform 0.35s cubic-bezier(0.68, -1.15, 0.265, 2.35), box-shadow 0.35s;
|
|
158
|
+
}
|
|
139
159
|
|
|
140
160
|
&:hover,
|
|
141
161
|
&:focus {
|
|
@@ -171,10 +191,6 @@ const CardWrapper = styled.div`
|
|
|
171
191
|
align-self: stretch;
|
|
172
192
|
border-radius: 1rem;
|
|
173
193
|
|
|
174
|
-
${({ $hasLink }) => (!$hasLink && css`
|
|
175
|
-
${defaultBoxShadow()}
|
|
176
|
-
`)}
|
|
177
|
-
|
|
178
194
|
// Full width mode - always full width, no constraints
|
|
179
195
|
${({ $isFullWidth }) => $isFullWidth && css`
|
|
180
196
|
width: 100%;
|
|
@@ -331,5 +347,6 @@ export {
|
|
|
331
347
|
ArrowIconOuter,
|
|
332
348
|
ArrowIconInner,
|
|
333
349
|
ArrowIconWrapper,
|
|
334
|
-
CardWrapper
|
|
350
|
+
CardWrapper,
|
|
351
|
+
CardLinkContent
|
|
335
352
|
};
|