Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework container level spacing for beta containers #12951

Merged
merged 4 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions dotcom-rendering/src/components/FlexibleGeneral.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,15 @@ export const SplashCardLayout = ({
absoluteServerTimes,
imageLoading,
aspectRatio,
isLastRow,
}: {
cards: DCRFrontCard[];
imageLoading: Loading;
containerPalette?: DCRContainerPalette;
showAge?: boolean;
absoluteServerTimes: boolean;
aspectRatio: AspectRatio;
isLastRow: boolean;
}) => {
const card = cards[0];
if (!card) return null;
Expand All @@ -183,7 +185,11 @@ export const SplashCardLayout = ({
);

return (
<UL padBottom={true} hasLargeSpacing={true} showTopBar={false}>
<UL
padBottom={!isLastRow}
hasLargeSpacing={!isLastRow}
showTopBar={false}
>
<LI
padSides={true}
verticalDividerColour={palette('--card-border-supporting')}
Expand Down Expand Up @@ -268,6 +274,7 @@ export const BoostedCardLayout = ({
imageLoading,
aspectRatio,
isFirstRow,
isLastRow,
}: {
cards: DCRFrontCard[];
imageLoading: Loading;
Expand All @@ -276,6 +283,7 @@ export const BoostedCardLayout = ({
absoluteServerTimes: boolean;
aspectRatio: AspectRatio;
isFirstRow: boolean;
isLastRow: boolean;
}) => {
const card = cards[0];
if (!card) return null;
Expand All @@ -287,7 +295,11 @@ export const BoostedCardLayout = ({
liveUpdatesPosition,
} = decideCardProperties(card.boostLevel);
return (
<UL padBottom={true} hasLargeSpacing={true} showTopBar={!isFirstRow}>
<UL
showTopBar={!isFirstRow}
padBottom={!isLastRow}
hasLargeSpacing={!isLastRow}
>
<LI
padSides={true}
verticalDividerColour={palette('--card-border-supporting')}
Expand Down Expand Up @@ -333,6 +345,7 @@ export const StandardCardLayout = ({
isFirstRow,
isFirstStandardRow,
aspectRatio,
isLastRow,
}: {
cards: DCRFrontCard[];
imageLoading: Loading;
Expand All @@ -343,14 +356,15 @@ export const StandardCardLayout = ({
absoluteServerTimes: boolean;
showImage?: boolean;
aspectRatio: AspectRatio;
isLastRow: boolean;
}) => {
if (cards.length === 0) return null;

return (
<UL
direction="row"
padBottom={true}
hasLargeSpacing={true}
padBottom={!isLastRow}
hasLargeSpacing={!isLastRow}
showTopBar={!isFirstRow}
/** We use one full top bar for the first row and use a split one for subsequent rows */
splitTopBar={!isFirstStandardRow}
Expand Down Expand Up @@ -429,6 +443,7 @@ export const FlexibleGeneral = ({
absoluteServerTimes={absoluteServerTimes}
imageLoading={imageLoading}
aspectRatio={aspectRatio}
isLastRow={cards.length === 0}
/>
)}

Expand All @@ -444,6 +459,7 @@ export const FlexibleGeneral = ({
imageLoading={imageLoading}
aspectRatio={aspectRatio}
isFirstRow={!splash.length && i === 0}
isLastRow={i === groupedCards.length - 1}
/>
);

Expand All @@ -460,6 +476,7 @@ export const FlexibleGeneral = ({
isFirstRow={!splash.length && i === 0}
isFirstStandardRow={i === 0}
aspectRatio={aspectRatio}
isLastRow={i === groupedCards.length - 1}
/>
);
}
Expand Down
13 changes: 6 additions & 7 deletions dotcom-rendering/src/components/FlexibleSpecial.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,15 @@ export const OneCardLayout = ({
absoluteServerTimes,
imageLoading,
aspectRatio,
isLastRow,
}: {
cards: DCRFrontCard[];
imageLoading: Loading;
containerPalette?: DCRContainerPalette;
showAge?: boolean;
absoluteServerTimes: boolean;
aspectRatio: AspectRatio;
isLastRow: boolean;
}) => {
const card = cards[0];
if (!card) return null;
Expand All @@ -137,7 +139,7 @@ export const OneCardLayout = ({
card.supportingContent?.length ?? 0,
);
return (
<UL padBottom={true} hasLargeSpacing={true}>
<UL padBottom={!isLastRow} hasLargeSpacing={!isLastRow}>
<LI padSides={true}>
<FrontCard
trail={card}
Expand Down Expand Up @@ -187,12 +189,7 @@ const TwoCardOrFourCardLayout = ({
if (cards.length === 0) return null;
const hasTwoOrFewerCards = cards.length <= 2;
return (
<UL
direction="row"
padBottom={true}
showTopBar={true}
hasLargeSpacing={true}
>
<UL direction="row" showTopBar={true}>
{cards.map((card, cardIndex) => {
return (
<LI
Expand Down Expand Up @@ -250,6 +247,7 @@ export const FlexibleSpecial = ({
absoluteServerTimes={absoluteServerTimes}
imageLoading={imageLoading}
aspectRatio={aspectRatio}
isLastRow={splash.length === 0 && cards.length === 0}
/>
<OneCardLayout
cards={splash}
Expand All @@ -258,6 +256,7 @@ export const FlexibleSpecial = ({
absoluteServerTimes={absoluteServerTimes}
imageLoading={imageLoading}
aspectRatio={aspectRatio}
isLastRow={cards.length === 0}
/>
<TwoCardOrFourCardLayout
cards={cards}
Expand Down
Loading
Loading