Skip to content

Commit 3d7ad15

Browse files
committed
Fix gallery secondary onward image size and padding
1 parent f22dd81 commit 3d7ad15

File tree

4 files changed

+60
-8
lines changed

4 files changed

+60
-8
lines changed

dotcom-rendering/fixtures/manual/onwardsTrails.ts

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { type TrailType } from '../../src/types/trails';
88

99
export const galleryOnwardsTrails: TrailType[] = [
1010
{
11-
url: 'http://localhost:9000/environment/gallery/2025/aug/22/week-in-wildlife-a-clumsy-fox-swinging-orangutang-and-rescued-jaguarundi-cub',
11+
url: 'https://www.theguardian.com/environment/gallery/2025/aug/22/week-in-wildlife-a-clumsy-fox-swinging-orangutang-and-rescued-jaguarundi-cub',
1212
linkText:
1313
'Week in wildlife: a clumsy fox, a swinging orangutan and a rescued jaguarundi cub',
1414
showByline: false,
@@ -47,7 +47,7 @@ export const galleryOnwardsTrails: TrailType[] = [
4747
mainMedia: { type: 'Gallery', count: '6' },
4848
},
4949
{
50-
url: 'http://localhost:9000/money/gallery/2025/aug/22/characterful-cottages-for-sale-in-england-in-pictures',
50+
url: 'https://www.theguardian.com/money/gallery/2025/aug/22/characterful-cottages-for-sale-in-england-in-pictures',
5151
linkText: 'Characterful cottages for sale in England – in pictures',
5252
showByline: false,
5353
byline: 'Anna White',
@@ -82,7 +82,7 @@ export const galleryOnwardsTrails: TrailType[] = [
8282
mainMedia: { type: 'Gallery', count: '6' },
8383
},
8484
{
85-
url: 'http://localhost:9000/news/gallery/2025/aug/22/sunsets-aid-parachutes-and-giant-pandas-photos-of-the-day-friday',
85+
url: 'https://www.theguardian.com/news/gallery/2025/aug/22/sunsets-aid-parachutes-and-giant-pandas-photos-of-the-day-friday',
8686
linkText:
8787
'Sunsets, aid parachutes and giant pandas: photos of the day – Friday ',
8888
showByline: false,
@@ -119,7 +119,7 @@ export const galleryOnwardsTrails: TrailType[] = [
119119
mainMedia: { type: 'Gallery', count: '6' },
120120
},
121121
{
122-
url: 'http://localhost:9000/fashion/gallery/2025/aug/22/what-to-wear-to-notting-hill-carnival',
122+
url: 'https://www.theguardian.com/fashion/gallery/2025/aug/22/what-to-wear-to-notting-hill-carnival',
123123
linkText: 'On parade: what to wear to Notting Hill carnival',
124124
showByline: false,
125125
byline: 'Melanie Wilkinson',
@@ -153,4 +153,40 @@ export const galleryOnwardsTrails: TrailType[] = [
153153
'The Guardian’s picture editors select photographs from around the world',
154154
mainMedia: { type: 'Gallery', count: '6' },
155155
},
156+
{
157+
url: 'https://www.theguardian.com/artanddesign/gallery/2025/aug/21/psychedelic-rock-glass-mountain-michael-lundgren',
158+
linkText:
159+
'Psychedelic rock! Formations that mess with your mind – in pictures ',
160+
showByline: false,
161+
image: {
162+
src: 'https://media.guim.co.uk/2810af61b2d2d2d5f71ec01e56e6555e0a6d4635/55_0_2813_2250/master/2813.jpg',
163+
altText: '',
164+
},
165+
format: {
166+
design: ArticleDesign.Gallery,
167+
theme: Pillar.Culture,
168+
display: ArticleDisplay.Standard,
169+
},
170+
webPublicationDate: '2025-08-21T06:01:01.000Z',
171+
headline:
172+
'Psychedelic rock! Formations that mess with your mind – in pictures ',
173+
shortUrl: 'https://www.theguardian.com/p/x2p663',
174+
discussion: {
175+
isCommentable: false,
176+
isClosedForComments: true,
177+
discussionId: '/p/x2p663',
178+
},
179+
dataLinkName: getDataLinkNameCard(
180+
{
181+
design: ArticleDesign.Gallery,
182+
theme: Pillar.Culture,
183+
display: ArticleDisplay.Standard,
184+
},
185+
'0',
186+
1,
187+
),
188+
trailText:
189+
'Politicians and their partners put on their best show at this year’s Midwinter Ball, an annual dinner hosted by the Federal Parliamentary Press Gallery in Canberra',
190+
mainMedia: { type: 'Gallery', count: '6' },
191+
},
156192
];

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,8 @@ export const Card = ({
604604
containerType === 'flexible/special' ||
605605
containerType === 'flexible/general';
606606

607-
const isSmallCard = containerType === 'scrollable/small';
607+
const isSmallCard =
608+
containerType === 'scrollable/small' || isGallerySecondaryOnward;
608609

609610
const hideTrailTextUntil = () => {
610611
if (isFlexibleContainer) {
@@ -635,6 +636,13 @@ export const Card = ({
635636
* Order matters here as the logic is based on the card properties
636637
*/
637638
const getGapSizes = (): GapSizes => {
639+
if (isGallerySecondaryOnward) {
640+
return {
641+
row: 'medium',
642+
column: 'medium',
643+
};
644+
}
645+
638646
if (isOnwardContent) {
639647
return {
640648
row: 'none',
@@ -749,7 +757,9 @@ export const Card = ({
749757
onwardContent: boolean,
750758
): 'large' | 'small' | undefined => {
751759
if (mediaCard && betaContainer) return 'large';
752-
if (mediaCard || onwardContent) return 'small';
760+
if ((mediaCard || onwardContent) && !isGallerySecondaryOnward) {
761+
return 'small';
762+
}
753763
return undefined;
754764
};
755765

@@ -1175,7 +1185,7 @@ export const Card = ({
11751185
padContent={determinePadContent(
11761186
isMediaCardOrNewsletter,
11771187
isBetaContainer,
1178-
isOnwardContent && !isMoreGalleriesOnwardContent,
1188+
isOnwardContent,
11791189
)}
11801190
>
11811191
{/* This div is needed to keep the headline and trail text justified at the start */}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { Meta, StoryObj } from '@storybook/react-webpack5';
22
import { galleryOnwardsTrails } from '../../fixtures/manual/onwardsTrails';
3+
import { ArticleDesign, ArticleDisplay, Pillar } from '../lib/articleFormat';
34
import { MoreGalleries as MoreGalleriesComponent } from './MoreGalleries';
45

56
const meta = {
@@ -16,5 +17,10 @@ export const MoreGalleries = {
1617
discussionApiUrl: 'https://discussion.theguardian.com/discussion-api',
1718
guardianBaseUrl: 'https://www.theguardian.com',
1819
trails: galleryOnwardsTrails,
20+
format: {
21+
design: ArticleDesign.Gallery,
22+
display: ArticleDisplay.Standard,
23+
theme: Pillar.Culture,
24+
},
1925
},
2026
} satisfies Story;

dotcom-rendering/src/components/ScrollableSmallOnwards.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ const getDefaultCardProps = (
221221
imageLoading: 'lazy',
222222
showAge: true,
223223
aspectRatio: '5:4',
224-
mediaSize: 'small',
224+
mediaSize: 'scrollable-small',
225225
mediaPositionOnDesktop: 'left',
226226
mediaPositionOnMobile: 'left',
227227
headlineSizes: {

0 commit comments

Comments
 (0)