Skip to content

Commit 0c3dc4f

Browse files
committed
Added comment. Put the flexBasis logic in MediaWrapper together
1 parent 41d4225 commit 0c3dc4f

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

dotcom-rendering/src/components/Card/Card.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ const podcastImageStyles = (
250250
width: 120px;
251251
height: 120px;
252252
}
253+
/** The image takes the full height on desktop, so that the waveform sticks to the bottom of the card. */
253254
${from.desktop} {
254255
width: ${isHorizontalOnDesktop ? 'unset' : '120px'};
255256
height: ${isHorizontalOnDesktop ? 'unset' : '120px'};

dotcom-rendering/src/components/Card/components/MediaWrapper.tsx

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,13 @@ const mediaPaddingStyles = (
7777
*/
7878
const flexBasisStyles = ({
7979
mediaSize,
80+
mediaType,
81+
isSmallCard,
8082
isBetaContainer,
8183
}: {
8284
mediaSize: MediaSizeType;
85+
mediaType: CardMediaType;
86+
isSmallCard: boolean;
8387
isBetaContainer: boolean;
8488
}): SerializedStyles => {
8589
if (!isBetaContainer) {
@@ -110,6 +114,15 @@ const flexBasisStyles = ({
110114
}
111115
}
112116

117+
if (mediaType === 'podcast' && !isSmallCard) {
118+
return css`
119+
flex-basis: 120px;
120+
${from.desktop} {
121+
flex-basis: 168px;
122+
}
123+
`;
124+
}
125+
113126
switch (mediaSize) {
114127
default:
115128
case 'small':
@@ -206,10 +219,13 @@ export const MediaWrapper = ({
206219
(mediaType === 'slideshow' ||
207220
mediaType === 'picture' ||
208221
mediaType === 'youtube-video' ||
209-
mediaType === 'loop-video') &&
222+
mediaType === 'loop-video' ||
223+
mediaType === 'podcast') &&
210224
isHorizontalOnDesktop &&
211225
flexBasisStyles({
212226
mediaSize,
227+
mediaType,
228+
isSmallCard,
213229
isBetaContainer,
214230
}),
215231
mediaType === 'avatar' &&
@@ -228,15 +244,6 @@ export const MediaWrapper = ({
228244
mediaType !== 'podcast' &&
229245
fixMobileMediaWidth(isBetaContainer, isSmallCard),
230246
isSmallCard && fixDesktopMediaWidth(),
231-
mediaType === 'podcast' &&
232-
isHorizontalOnDesktop &&
233-
!isSmallCard &&
234-
css`
235-
flex-basis: 120px;
236-
${from.desktop} {
237-
flex-basis: 168px;
238-
}
239-
`,
240247
isHorizontalOnDesktop &&
241248
css`
242249
${from.tablet} {

0 commit comments

Comments
 (0)