Skip to content

Commit d113a72

Browse files
authored
Merge pull request #13857 from guardian/doml/opinion-headline-size
Don't bump Opinion cards headline size when no image
2 parents abb76a7 + 4c2207b commit d113a72

File tree

3 files changed

+77
-20
lines changed

3 files changed

+77
-20
lines changed

dotcom-rendering/fixtures/manual/trails.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,49 @@ export const audioTrails: [DCRFrontCard, DCRFrontCard] = [
683683
},
684684
];
685685

686+
export const opinionTrails: [DCRFrontCard, DCRFrontCard] = [
687+
{
688+
format: { design: 8, display: 0, theme: 1 },
689+
dataLinkName: 'comment | group-0 | card-@6',
690+
url: '/commentisfree/2025/apr/28/populists-nigel-farage-reform-chaos-brexit',
691+
headline:
692+
'Populists like Farage promise voters a simpler life. In fact, they produce ever more hassle and chaos',
693+
trailText:
694+
'Centrists won’t beat Reform UK by echoing its messages. They should emphasise the true unworkability of policies like Brexit, says Guardian columnist Andy Beckett',
695+
webPublicationDate: '2025-04-28T05:00:53.000Z',
696+
discussionApiUrl:
697+
'https://discussion.code.dev-theguardian.com/discussion-api',
698+
discussionId: '/p/x253na',
699+
isImmersive: false,
700+
showQuotedHeadline: true,
701+
isExternalLink: false,
702+
showLivePlayable: false,
703+
avatarUrl: 'https://uploads.guim.co.uk/2022/09/20/Andy_Beckett_v2.png',
704+
image: {
705+
src: 'https://media.guim.co.uk/f55906c2b9116946c778cd1fca808a6dae764d01/0_0_9528_5715/master/9528.jpg',
706+
altText:
707+
'Nigel Farage on the campaign trail in Ramsgate, Kent, on 24 April.',
708+
},
709+
},
710+
{
711+
format: { design: 8, display: 0, theme: 1 },
712+
dataLinkName: 'comment | group-0 | card-@5',
713+
url: '/commentisfree/2025/apr/28/duttons-comments-show-we-are-back-to-punching-down-on-indigenous-australians-for-attention-and-votes',
714+
headline:
715+
'Dutton’s comments show we are back to punching down on Indigenous Australians for attention – and votes',
716+
trailText:
717+
'It is disingenuous for politicians to be shocked when people decide to turn words into action, even in the predawn hush of Anzac Day',
718+
webPublicationDate: '2025-04-28T05:19:42.000Z',
719+
discussionApiUrl:
720+
'https://discussion.code.dev-theguardian.com/discussion-api',
721+
byline: 'Lorena Allam',
722+
isImmersive: false,
723+
showQuotedHeadline: true,
724+
showLivePlayable: false,
725+
isExternalLink: false,
726+
},
727+
];
728+
686729
export const galleryTrails: [DCRFrontCard, DCRFrontCard] = [
687730
{
688731
format: { design: 2, display: 1, theme: 4 },

dotcom-rendering/src/components/FlexibleGeneral.stories.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import { breakpoints } from '@guardian/source/foundations';
22
import type { Meta, StoryObj } from '@storybook/react';
33
import { discussionApiUrl } from '../../fixtures/manual/discussionApiUrl';
4-
import { getSublinks, trails } from '../../fixtures/manual/trails';
4+
import {
5+
getSublinks,
6+
opinionTrails,
7+
trails,
8+
} from '../../fixtures/manual/trails';
59
import { ArticleDesign, ArticleDisplay, Pillar } from '../lib/articleFormat';
610
import { customMockFetch } from '../lib/mockRESTCalls';
711
import type {
@@ -493,6 +497,17 @@ export const GigaBoostedSplashWithLiveUpdates: Story = {
493497
},
494498
};
495499

500+
export const OpinionStandardCardsWithImageSuppression: Story = {
501+
name: 'Opinion standard cards with image supression',
502+
args: {
503+
frontSectionTitle: 'Opinion standard cards',
504+
groupedTrails: {
505+
...defaultGroupedTrails,
506+
standard: opinionTrails.slice(0, 2),
507+
},
508+
},
509+
};
510+
496511
const containerPalettes = [
497512
'InvestigationPalette',
498513
'LongRunningPalette',

dotcom-rendering/src/components/FlexibleGeneral.tsx

Lines changed: 18 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,12 @@ export const SplashCardLayout = ({
269263
);
270264
}
271265

266+
const useLargerHeadlineSizeDesktop =
267+
// When there's no image, we want the text to take up more space. The exception is Opinion
268+
// cards, as avatars are more common and command less visual weight than a standard image.
269+
(!card.image && card.format.design !== ArticleDesign.Comment) ||
270+
card.showLivePlayable;
271+
272272
const {
273273
headlineSizes,
274274
imagePositionOnDesktop,
@@ -281,8 +281,7 @@ export const SplashCardLayout = ({
281281
card.boostLevel ?? 'default',
282282
card.supportingContent?.length ?? 0,
283283
isMediaCard(card.format),
284-
card.showLivePlayable,
285-
!card.image,
284+
useLargerHeadlineSizeDesktop,
286285
!!card.avatarUrl,
287286
);
288287

@@ -555,9 +554,9 @@ const HalfWidthCardLayout = ({
555554
(containerLevel !== 'Primary' && cardIndex > 0)
556555
}
557556
trailText={undefined}
558-
// On standard cards, we increase the headline size if the trail image has been hidden
559557
headlineSizes={
560-
!card.image
558+
!card.image &&
559+
card.format.design !== ArticleDesign.Comment
561560
? {
562561
desktop: 'small',
563562
tablet: 'xsmall',

0 commit comments

Comments
 (0)