Skip to content

Commit 4646f30

Browse files
committed
Alter logic for desktop size bump for opinion cards and no image
1 parent 91fbc93 commit 4646f30

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

dotcom-rendering/src/components/FlexibleGeneral.tsx

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -156,18 +156,15 @@ const decideSplashCardProperties = (
156156
boostLevel: BoostLevel,
157157
supportingContentLength: number,
158158
mediaCard: boolean,
159-
hasLivePlayable: boolean,
160-
imageSuppressed: boolean,
159+
useLargerHeadlineSizeDesktop: boolean,
161160
avatarUrl: boolean,
162161
): BoostedSplashProperties => {
163162
switch (boostLevel) {
164-
// boostedfont sizing
165163
// The default boost level is equal to no boost. It is the same as the default card layout.
166164
case 'default':
167165
return {
168166
headlineSizes: {
169-
desktop:
170-
imageSuppressed || hasLivePlayable ? 'large' : 'medium',
167+
desktop: useLargerHeadlineSizeDesktop ? 'large' : 'medium',
171168
tablet: 'medium',
172169
mobile: 'medium',
173170
},
@@ -182,8 +179,7 @@ const decideSplashCardProperties = (
182179
case 'boost':
183180
return {
184181
headlineSizes: {
185-
desktop:
186-
imageSuppressed || hasLivePlayable ? 'xlarge' : 'large',
182+
desktop: useLargerHeadlineSizeDesktop ? 'xlarge' : 'large',
187183
tablet: 'large',
188184
mobile: 'large',
189185
},
@@ -198,10 +194,9 @@ const decideSplashCardProperties = (
198194
case 'megaboost':
199195
return {
200196
headlineSizes: {
201-
desktop:
202-
imageSuppressed || hasLivePlayable
203-
? 'xxlarge'
204-
: 'xlarge',
197+
desktop: useLargerHeadlineSizeDesktop
198+
? 'xxlarge'
199+
: 'xlarge',
205200
tablet: 'xlarge',
206201
mobile: 'xlarge',
207202
},
@@ -215,10 +210,9 @@ const decideSplashCardProperties = (
215210
case 'gigaboost':
216211
return {
217212
headlineSizes: {
218-
desktop:
219-
imageSuppressed || hasLivePlayable
220-
? 'xxxlarge'
221-
: 'xxlarge',
213+
desktop: useLargerHeadlineSizeDesktop
214+
? 'xxxlarge'
215+
: 'xxlarge',
222216
tablet: 'xlarge',
223217
mobile: 'xxlarge',
224218
},
@@ -269,6 +263,11 @@ export const SplashCardLayout = ({
269263
);
270264
}
271265

266+
// We sometimes want to give the headline size on desktop a size bump.
267+
const useLargerHeadlineSizeDesktop =
268+
(!card.image && card.format.design !== ArticleDesign.Comment) ||
269+
card.showLivePlayable;
270+
272271
const {
273272
headlineSizes,
274273
imagePositionOnDesktop,
@@ -281,8 +280,7 @@ export const SplashCardLayout = ({
281280
card.boostLevel ?? 'default',
282281
card.supportingContent?.length ?? 0,
283282
isMediaCard(card.format),
284-
card.showLivePlayable,
285-
!card.image,
283+
useLargerHeadlineSizeDesktop,
286284
!!card.avatarUrl,
287285
);
288286

@@ -555,9 +553,9 @@ const HalfWidthCardLayout = ({
555553
(containerLevel !== 'Primary' && cardIndex > 0)
556554
}
557555
trailText={undefined}
558-
// On standard cards, we increase the headline size if the trail image has been hidden
559556
headlineSizes={
560-
!card.image
557+
!card.image &&
558+
card.format.design !== ArticleDesign.Comment
561559
? {
562560
desktop: 'small',
563561
tablet: 'xsmall',

0 commit comments

Comments
 (0)