Skip to content

Commit 566e192

Browse files
committed
add contextFormat to CardWrapper
We need to use this tyo distinguish between the format of the card article and format of the article which holds the card
1 parent a3cec70 commit 566e192

File tree

4 files changed

+21
-12
lines changed

4 files changed

+21
-12
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,7 @@ export const Card = ({
835835
showTopBarMobile={showTopBarMobile}
836836
isOnwardContent={isOnwardContent}
837837
containerPalette={containerPalette}
838+
contextFormat={contextFormat}
838839
>
839840
<CardLink
840841
linkTo={linkTo}

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

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ type Props = {
1313
showTopBarMobile: boolean;
1414
isOnwardContent: boolean;
1515
containerPalette?: DCRContainerPalette;
16+
contextFormat?: ArticleFormat;
1617
};
1718

1819
const baseCardStyles = css`
@@ -72,24 +73,27 @@ const hoverStyles = css`
7273
}
7374
`;
7475

75-
const topBarStyles = css`
76+
const topBarStyles = (isGalleryOnwardContent: boolean) => css`
7677
::before {
77-
border-top: 1px solid ${palette('--card-border-top')};
78+
border-top: 1px solid
79+
${isGalleryOnwardContent
80+
? palette('--onward-content-border')
81+
: palette('--card-border-top')};
7882
content: '';
7983
z-index: 2;
8084
width: 100%;
8185
padding-bottom: ${space[2]}px;
8286
background-color: unset;
8387
}
8488
`;
85-
const mobileTopBarStyles = css`
89+
const mobileTopBarStyles = (isGalleryOnwardContent: boolean) => css`
8690
${until.tablet} {
87-
${topBarStyles}
91+
${topBarStyles(isGalleryOnwardContent)}
8892
}
8993
`;
90-
const desktopTopBarStyles = css`
94+
const desktopTopBarStyles = (isGalleryOnwardContent: boolean) => css`
9195
${from.tablet} {
92-
${topBarStyles}
96+
${topBarStyles(isGalleryOnwardContent)}
9397
}
9498
`;
9599

@@ -109,19 +113,22 @@ export const CardWrapper = ({
109113
showTopBarMobile,
110114
isOnwardContent,
111115
containerPalette,
116+
contextFormat,
112117
}: Props) => {
118+
const isGalleryOnwardContent =
119+
isOnwardContent && contextFormat?.design === ArticleDesign.Gallery;
113120
return (
114121
<FormatBoundary format={format}>
115122
<ContainerOverrides containerPalette={containerPalette}>
116123
<div
117124
css={[
118125
baseCardStyles,
119126
hoverStyles,
120-
showTopBarDesktop && desktopTopBarStyles,
121-
showTopBarMobile && mobileTopBarStyles,
122-
isOnwardContent &&
123-
format.design !== ArticleDesign.Gallery &&
124-
onwardContentStyles,
127+
showTopBarDesktop &&
128+
desktopTopBarStyles(isGalleryOnwardContent),
129+
showTopBarMobile &&
130+
mobileTopBarStyles(isGalleryOnwardContent),
131+
!isGalleryOnwardContent && onwardContentStyles,
125132
]}
126133
>
127134
{children}

dotcom-rendering/src/components/ScrollableSmallOnwards.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ const getDefaultCardProps = (
233233
supportingContent: undefined,
234234
canPlayInline: false,
235235
onwardsSource,
236+
isOnwardContent: true,
236237
};
237238
return defaultProps;
238239
};

dotcom-rendering/src/layouts/GalleryLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ export const GalleryLayout = (props: WebProps | AppProps) => {
217217
trails={gallery.storyPackage?.trails ?? []}
218218
discussionApiUrl={discussionApiUrl}
219219
format={format}
220-
heading={gallery.storyPackage?.heading ?? 'Marjan'} // TODO
220+
heading={gallery.storyPackage?.heading ?? 'More on this story'}
221221
onwardsSource={'more-on-this-story'}
222222
/>
223223
<Island priority="feature" defer={{ until: 'visible' }}>

0 commit comments

Comments
 (0)