Skip to content

Commit 96d92be

Browse files
committed
Fix gallery secondary onward image size and padding
1 parent f22dd81 commit 96d92be

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

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

Lines changed: 16 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,12 @@ export const Card = ({
749757
onwardContent: boolean,
750758
): 'large' | 'small' | undefined => {
751759
if (mediaCard && betaContainer) return 'large';
752-
if (mediaCard || onwardContent) return 'small';
760+
if (
761+
(mediaCard || onwardContent) &&
762+
!(isGallerySecondaryOnward || isMoreGalleriesOnwardContent)
763+
) {
764+
return 'small';
765+
}
753766
return undefined;
754767
};
755768

@@ -1175,7 +1188,7 @@ export const Card = ({
11751188
padContent={determinePadContent(
11761189
isMediaCardOrNewsletter,
11771190
isBetaContainer,
1178-
isOnwardContent && !isMoreGalleriesOnwardContent,
1191+
isOnwardContent,
11791192
)}
11801193
>
11811194
{/* 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)