Skip to content

Commit

Permalink
Merge branch 'main' into jm/move-article-format-ar
Browse files Browse the repository at this point in the history
  • Loading branch information
SiAdcock authored Oct 9, 2024
2 parents 5e3266e + 4f75a0d commit 5fd22a0
Show file tree
Hide file tree
Showing 12 changed files with 436 additions and 69 deletions.
4 changes: 2 additions & 2 deletions dotcom-rendering/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@guardian/bridget": "7.0.0",
"@guardian/browserslist-config": "6.1.0",
"@guardian/cdk": "50.13.0",
"@guardian/commercial": "22.1.0",
"@guardian/commercial": "22.3.0",
"@guardian/core-web-vitals": "7.0.0",
"@guardian/eslint-config": "7.0.1",
"@guardian/eslint-config-typescript": "9.0.1",
Expand All @@ -51,7 +51,7 @@
"@guardian/ophan-tracker-js": "2.2.5",
"@guardian/shimport": "1.0.2",
"@guardian/source": "8.0.0",
"@guardian/source-development-kitchen": "9.0.0",
"@guardian/source-development-kitchen": "11.0.0",
"@guardian/support-dotcom-components": "2.9.1",
"@guardian/tsconfig": "0.2.0",
"@playwright/test": "1.45.3",
Expand Down
2 changes: 2 additions & 0 deletions dotcom-rendering/src/components/Card/Card.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1575,6 +1575,8 @@ export const WithALargeGap = () => {
design: ArticleDesign.Comment,
theme: Pillar.Opinion,
}}
showTopBarDesktop={false}
showTopBarMobile={true}
/>
</div>
</CardWrapper>
Expand Down
11 changes: 7 additions & 4 deletions dotcom-rendering/src/components/Card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ export type Props = {
index?: number;
/** The Splash card in a flexible container gets a different visual treatment to other cards*/
isFlexSplash?: boolean;
showTopBarDesktop?: boolean;
showTopBarMobile?: boolean;
};

const starWrapper = (cardHasImage: boolean) => css`
Expand Down Expand Up @@ -268,6 +270,8 @@ export const Card = ({
boostedFontSizes,
index = 0,
isFlexSplash,
showTopBarDesktop = true,
showTopBarMobile = false,
}: Props) => {
const hasSublinks = supportingContent && supportingContent.length > 0;
const sublinkPosition = decideSublinkPosition(
Expand Down Expand Up @@ -454,8 +458,8 @@ export const Card = ({
return (
<CardWrapper
format={format}
showTopBar={!isOnwardContent && !isFlexibleSpecialContainer}
showMobileTopBar={isFlexibleSpecialContainer}
showTopBarDesktop={!isOnwardContent && showTopBarDesktop}
showTopBarMobile={showTopBarMobile}
containerPalette={containerPalette}
isOnwardContent={isOnwardContent}
>
Expand Down Expand Up @@ -759,8 +763,7 @@ export const Card = ({
)}
{sublinkPosition === 'outer' &&
supportingContentAlignment === 'horizontal' &&
(imagePositionOnDesktop === 'right' ||
imagePositionOnDesktop === 'left') && (
imagePositionOnDesktop === 'right' && (
<HorizontalDivider />
)}
</div>
Expand Down
16 changes: 8 additions & 8 deletions dotcom-rendering/src/components/Card/components/CardWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ type Props = {
children: React.ReactNode;
format: ArticleFormat;
containerPalette?: DCRContainerPalette;
showTopBar?: boolean;
showMobileTopBar?: boolean;
showTopBarDesktop?: boolean;
showTopBarMobile?: boolean;
isOnwardContent?: boolean;
};

Expand Down Expand Up @@ -70,7 +70,7 @@ const sublinkHoverStyles = css`
}
`;

const topBarStyles = css`
const desktopTopBarStyles = css`
:before {
border-top: 1px solid ${palette('--card-border-top')};
content: '';
Expand All @@ -83,7 +83,7 @@ const topBarStyles = css`

const mobileTopBarStyles = css`
${until.tablet} {
${topBarStyles}
${desktopTopBarStyles}
}
`;

Expand All @@ -100,8 +100,8 @@ export const CardWrapper = ({
children,
format,
containerPalette,
showTopBar = true,
showMobileTopBar = false,
showTopBarDesktop = true,
showTopBarMobile = false,
isOnwardContent = false,
}: Props) => {
return (
Expand All @@ -112,8 +112,8 @@ export const CardWrapper = ({
baseCardStyles,
hoverStyles,
sublinkHoverStyles,
showTopBar && topBarStyles,
showMobileTopBar && mobileTopBarStyles,
showTopBarDesktop && desktopTopBarStyles,
showTopBarMobile && mobileTopBarStyles,
isOnwardContent && onwardContentStyles,
]}
>
Expand Down
2 changes: 2 additions & 0 deletions dotcom-rendering/src/components/Carousel.importable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,8 @@ const CarouselCard = ({
absoluteServerTimes={absoluteServerTimes}
starRating={starRating}
index={index}
showTopBarDesktop={!isOnwardContent}
showTopBarMobile={false}
/>
</LI>
);
Expand Down
24 changes: 21 additions & 3 deletions dotcom-rendering/src/components/FlexibleGeneral.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ type BoostedSplashProperties = {
headlineSizeOnTablet: SmallHeadlineSize;
imagePositionOnDesktop: ImagePositionType;
imagePositionOnMobile: ImagePositionType;
imageSize: ImageSizeType;
supportingContentAlignment: Alignment;
};

Expand All @@ -89,6 +90,7 @@ const decideSplashCardProperties = (
headlineSizeOnTablet: 'tiny',
imagePositionOnDesktop: 'right',
imagePositionOnMobile: 'bottom',
imageSize: 'large',
supportingContentAlignment:
supportingContentLength >= 4 ? 'horizontal' : 'vertical',
};
Expand All @@ -99,6 +101,7 @@ const decideSplashCardProperties = (
headlineSizeOnTablet: 'small',
imagePositionOnDesktop: 'right',
imagePositionOnMobile: 'bottom',
imageSize: 'jumbo',
supportingContentAlignment:
supportingContentLength >= 4 ? 'horizontal' : 'vertical',
};
Expand All @@ -109,6 +112,7 @@ const decideSplashCardProperties = (
headlineSizeOnTablet: 'medium',
imagePositionOnDesktop: 'bottom',
imagePositionOnMobile: 'bottom',
imageSize: 'jumbo',
supportingContentAlignment: 'horizontal',
};
case 'gigaboost':
Expand All @@ -118,6 +122,7 @@ const decideSplashCardProperties = (
headlineSizeOnTablet: 'medium',
imagePositionOnDesktop: 'bottom',
imagePositionOnMobile: 'bottom',
imageSize: 'jumbo',
supportingContentAlignment: 'horizontal',
};
}
Expand Down Expand Up @@ -145,6 +150,7 @@ export const SplashCardLayout = ({
headlineSizeOnTablet,
imagePositionOnDesktop,
imagePositionOnMobile,
imageSize,
supportingContentAlignment,
} = decideSplashCardProperties(
card.boostLevel ?? 'default',
Expand All @@ -165,7 +171,7 @@ export const SplashCardLayout = ({
headlineSizeOnTablet={headlineSizeOnTablet}
imagePositionOnDesktop={imagePositionOnDesktop}
imagePositionOnMobile={imagePositionOnMobile}
imageSize="jumbo"
imageSize={imageSize}
trailText={card.trailText}
supportingContent={card.supportingContent}
supportingContentAlignment={supportingContentAlignment}
Expand All @@ -175,6 +181,8 @@ export const SplashCardLayout = ({
showLivePlayable={card.showLivePlayable}
boostedFontSizes={true}
isFlexSplash={true}
showTopBarDesktop={false}
showTopBarMobile={true}
/>
</LI>
</UL>
Expand Down Expand Up @@ -236,7 +244,7 @@ export const BoostedCardLayout = ({
imageSize,
} = decideCardProperties(card.boostLevel);
return (
<UL padBottom={true} isFlexibleContainer={true}>
<UL padBottom={true} isFlexibleContainer={true} showTopBar={true}>
<LI padSides={true}>
<FrontCard
trail={card}
Expand All @@ -256,6 +264,8 @@ export const BoostedCardLayout = ({
aspectRatio="5:4"
kickerText={card.kickerText}
showLivePlayable={card.showLivePlayable}
showTopBarDesktop={false}
showTopBarMobile={true}
/>
</LI>
</UL>
Expand All @@ -278,7 +288,12 @@ export const StandardCardLayout = ({
showImage?: boolean;
}) => {
return (
<UL direction="row" padBottom={true} isFlexibleContainer={true}>
<UL
direction="row"
padBottom={true}
isFlexibleContainer={true}
showTopBar={true}
>
{cards.map((card, cardIndex) => {
return (
<LI
Expand All @@ -298,10 +313,13 @@ export const StandardCardLayout = ({
imageLoading={imageLoading}
imagePositionOnDesktop={'left'}
supportingContent={card.supportingContent}
supportingContentAlignment="horizontal"
imageSize={'medium'}
aspectRatio="5:4"
kickerText={card.kickerText}
showLivePlayable={false}
showTopBarDesktop={false}
showTopBarMobile={true}
/>
</LI>
);
Expand Down
17 changes: 15 additions & 2 deletions dotcom-rendering/src/components/FlexibleSpecial.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import type {
DCRFrontCard,
DCRGroupedTrails,
} from '../types/front';
import type { ImagePositionType } from './Card/components/ImageWrapper';
import type {
ImagePositionType,
ImageSizeType,
} from './Card/components/ImageWrapper';
import { LI } from './Card/components/LI';
import { UL } from './Card/components/UL';
import type { Loading } from './CardPicture';
Expand All @@ -25,6 +28,7 @@ type BoostProperties = {
headlineSizeOnTablet: SmallHeadlineSize;
imagePositionOnDesktop: ImagePositionType;
imagePositionOnMobile: ImagePositionType;
imageSize: ImageSizeType;
supportingContentAlignment: Alignment;
};

Expand All @@ -44,6 +48,7 @@ const determineCardProperties = (
headlineSizeOnTablet: 'small',
imagePositionOnDesktop: 'right',
imagePositionOnMobile: 'bottom',
imageSize: 'large',
supportingContentAlignment:
supportingContentLength >= 3 ? 'horizontal' : 'vertical',
};
Expand All @@ -54,6 +59,7 @@ const determineCardProperties = (
headlineSizeOnTablet: 'medium',
imagePositionOnDesktop: 'right',
imagePositionOnMobile: 'bottom',
imageSize: 'jumbo',
supportingContentAlignment:
supportingContentLength >= 3 ? 'horizontal' : 'vertical',
};
Expand All @@ -64,6 +70,7 @@ const determineCardProperties = (
headlineSizeOnTablet: 'medium',
imagePositionOnDesktop: 'bottom',
imagePositionOnMobile: 'bottom',
imageSize: 'jumbo',
supportingContentAlignment: 'horizontal',
};
case 'gigaboost':
Expand All @@ -73,6 +80,7 @@ const determineCardProperties = (
headlineSizeOnTablet: 'large',
imagePositionOnDesktop: 'bottom',
imagePositionOnMobile: 'bottom',
imageSize: 'jumbo',
supportingContentAlignment: 'horizontal',
};
}
Expand All @@ -99,6 +107,7 @@ export const OneCardLayout = ({
headlineSizeOnTablet,
imagePositionOnDesktop,
imagePositionOnMobile,
imageSize,
supportingContentAlignment,
} = determineCardProperties(
card.boostLevel ?? 'default',
Expand All @@ -118,7 +127,7 @@ export const OneCardLayout = ({
headlineSizeOnTablet={headlineSizeOnTablet}
imagePositionOnDesktop={imagePositionOnDesktop}
imagePositionOnMobile={imagePositionOnMobile}
imageSize="jumbo"
imageSize={imageSize}
trailText={card.trailText}
supportingContent={card.supportingContent}
supportingContentAlignment={supportingContentAlignment}
Expand All @@ -128,6 +137,8 @@ export const OneCardLayout = ({
showLivePlayable={card.showLivePlayable}
boostedFontSizes={true}
isFlexSplash={true}
showTopBarDesktop={false}
showTopBarMobile={true}
/>
</LI>
</UL>
Expand Down Expand Up @@ -183,6 +194,8 @@ const TwoCardOrFourCardLayout = ({
aspectRatio="5:4"
kickerText={card.kickerText}
showLivePlayable={false}
showTopBarDesktop={false}
showTopBarMobile={true}
/>
</LI>
);
Expand Down
Loading

0 comments on commit 5fd22a0

Please sign in to comment.