Skip to content

Commit 6c4bf93

Browse files
authored
Merge pull request #14666 from guardian/remove-un-necessary-onward-container-type
Remove the unnecessary OnwardContainerType
2 parents f9bfc9c + 4762489 commit 6c4bf93

File tree

4 files changed

+24
-14
lines changed

4 files changed

+24
-14
lines changed

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

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import type {
3333
DCRSupportingContent,
3434
} from '../../types/front';
3535
import type { MainMedia } from '../../types/mainMedia';
36-
import type { OnwardContainerType, OnwardsSource } from '../../types/onwards';
36+
import type { OnwardsSource } from '../../types/onwards';
3737
import { Avatar } from '../Avatar';
3838
import { CardCommentCount } from '../CardCommentCount.importable';
3939
import { CardHeadline, type ResponsiveFontSize } from '../CardHeadline';
@@ -124,7 +124,7 @@ export type Props = {
124124
supportingContentPosition?: Position;
125125
snapData?: DCRSnapType;
126126
containerPalette?: DCRContainerPalette;
127-
containerType?: DCRContainerType | OnwardContainerType;
127+
containerType?: DCRContainerType;
128128
showAge?: boolean;
129129
discussionApiUrl: string;
130130
discussionId?: string;
@@ -588,8 +588,6 @@ export const Card = ({
588588
containerType === 'flexible/special' ||
589589
containerType === 'flexible/general';
590590

591-
const isOnwardContainer = containerType === 'more-galleries';
592-
593591
const isSmallCard =
594592
containerType === 'scrollable/small' ||
595593
containerType === 'scrollable/medium';
@@ -624,7 +622,9 @@ export const Card = ({
624622
return 'tablet';
625623
};
626624

627-
const shouldShowTrailText = isOnwardContainer
625+
const isMoreGalleriesOnwardContent =
626+
isOnwardContent && onwardsSource === 'more-galleries';
627+
const shouldShowTrailText = isMoreGalleriesOnwardContent
628628
? media?.type !== 'podcast' && isOnwardSplash
629629
: media?.type !== 'podcast';
630630

@@ -1066,7 +1066,10 @@ export const Card = ({
10661066
imageSize={mediaSize}
10671067
alt={headlineText}
10681068
loading={imageLoading}
1069-
roundedCorners={isOnwardContent}
1069+
roundedCorners={
1070+
isOnwardContent &&
1071+
!isMoreGalleriesOnwardContent
1072+
}
10701073
aspectRatio={aspectRatio}
10711074
isInAllBoostsTest={
10721075
isInAllBoostsTest
@@ -1083,7 +1086,10 @@ export const Card = ({
10831086
imageSize={mediaSize}
10841087
alt={media.imageAltText}
10851088
loading={imageLoading}
1086-
roundedCorners={isOnwardContent}
1089+
roundedCorners={
1090+
isOnwardContent &&
1091+
!isMoreGalleriesOnwardContent
1092+
}
10871093
aspectRatio={aspectRatio}
10881094
isInAllBoostsTest={isInAllBoostsTest}
10891095
/>
@@ -1121,7 +1127,10 @@ export const Card = ({
11211127
imageSize="small"
11221128
alt={media.imageAltText}
11231129
loading={imageLoading}
1124-
roundedCorners={isOnwardContent}
1130+
roundedCorners={
1131+
isOnwardContent &&
1132+
!isMoreGalleriesOnwardContent
1133+
}
11251134
aspectRatio="1:1"
11261135
/>
11271136
</div>
@@ -1152,7 +1161,7 @@ export const Card = ({
11521161
padContent={determinePadContent(
11531162
isMediaCardOrNewsletter,
11541163
isBetaContainer,
1155-
isOnwardContent,
1164+
isOnwardContent && !isMoreGalleriesOnwardContent,
11561165
)}
11571166
>
11581167
{/* This div is needed to keep the headline and trail text justified at the start */}

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { css } from '@emotion/react';
22
import { from, space, until } from '@guardian/source/foundations';
3-
import type { ArticleFormat } from '../../../lib/articleFormat';
3+
import { ArticleDesign, type ArticleFormat } from '../../../lib/articleFormat';
44
import { palette } from '../../../palette';
55
import type { DCRContainerPalette } from '../../../types/front';
66
import { ContainerOverrides } from '../../ContainerOverrides';
@@ -117,7 +117,9 @@ export const CardWrapper = ({
117117
hoverStyles,
118118
showTopBarDesktop && desktopTopBarStyles,
119119
showTopBarMobile && mobileTopBarStyles,
120-
isOnwardContent && onwardContentStyles,
120+
isOnwardContent &&
121+
format.design !== ArticleDesign.Gallery &&
122+
onwardContentStyles,
121123
]}
122124
>
123125
{children}

dotcom-rendering/src/components/MoreGalleries.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,11 @@ const getDefaultCardProps = (
109109
imageLoading: 'lazy',
110110
trailText: trail.trailText,
111111
showAge: false,
112-
containerType: 'more-galleries',
113112
showTopBarDesktop: false,
114113
showTopBarMobile: false,
115114
aspectRatio: '5:4',
115+
isOnwardContent: true,
116+
onwardsSource: 'more-galleries',
116117
};
117118
return defaultProps;
118119
};

dotcom-rendering/src/types/onwards.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,3 @@ export type OnwardsSource =
2424
| 'curated-content'
2525
| 'newsletters-page'
2626
| 'unknown-source'; // We should never see this in the analytics data!
27-
28-
export type OnwardContainerType = 'more-galleries';

0 commit comments

Comments
 (0)