Skip to content
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
6 changes: 3 additions & 3 deletions ab-testing/config/abTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ const ABTests: ABTest[] = [
{
name: "fronts-and-curation-slim-homepage",
description:
"Test placing the Most Viewed and Deeply Read components in the right-hand column on the homepage.",
"Test slimming content and placing Most Popular components on the right-hand side on the UK front.",
owners: ["fronts.and.curation@guardian.co.uk"],
status: "ON",
expirationDate: `2026-04-28`,
expirationDate: "2026-04-28",
type: "server",
audienceSize: 0 / 100,
audienceSpace: "A",
groups: ["control", "variant"],
groups: ["control", "variant-one", "variant-two"],
shouldForceMetricsCollection: false,
},
{
Expand Down
22 changes: 21 additions & 1 deletion dotcom-rendering/src/components/Card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ export type Props = {
headlinePosition?: 'inner' | 'outer';
isStorylines?: boolean;
starRatingSize?: RatingSizeType;
isInSlimHomepageAbTestVariant?: boolean;
};

const waveformWrapper = (
Expand Down Expand Up @@ -406,6 +407,7 @@ export const Card = ({
isStorylines = false,
starRatingSize = 'small',
articleMedia,
isInSlimHomepageAbTestVariant,
}: Props) => {
const hasSublinks = supportingContent && supportingContent.length > 0;
const sublinkPosition = decideSublinkPosition(
Expand Down Expand Up @@ -701,6 +703,14 @@ export const Card = ({
return <Sublinks />;
}

if (isInSlimHomepageAbTestVariant) {
return (
<Hide until="wide">
<Sublinks />
</Hide>
);
}

return (
<Hide from={isFlexSplash ? 'desktop' : 'tablet'}>
<Sublinks />
Expand All @@ -712,7 +722,7 @@ export const Card = ({
if (!hasSublinks) return null;
if (sublinkPosition !== 'inner') return null;

return (
const Sublinks = () => (
<Hide until={isFlexSplash ? 'desktop' : 'tablet'}>
{isStorylines ? (
<SupportingKeyStoriesContent
Expand All @@ -736,6 +746,16 @@ export const Card = ({
)}
</Hide>
);

if (isInSlimHomepageAbTestVariant) {
return (
<Hide from="wide">
<Sublinks />
</Hide>
);
}

return <Sublinks />;
};

const determinePadContent = (
Expand Down
23 changes: 20 additions & 3 deletions dotcom-rendering/src/components/CardHeadline.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { css } from '@emotion/react';
import {
between,
from,
headlineMedium14,
headlineMedium15,
headlineMedium17,
Expand Down Expand Up @@ -142,6 +143,7 @@ export enum FontFamily {
export type HeadlineSize = keyof typeof fontFamilies.headlineMedium;

export type ResponsiveFontSize = {
wide?: HeadlineSize;
desktop: HeadlineSize;
tablet?: HeadlineSize;
mobile?: HeadlineSize;
Expand All @@ -151,7 +153,7 @@ export type ResponsiveFontSize = {
const getFontSize = (sizes: ResponsiveFontSize, family: FontFamily) => {
const font = fontFamilies[family];

const { desktop, tablet, mobileMedium, mobile } = sizes;
const { wide, desktop, tablet, mobileMedium, mobile } = sizes;

return css`
${font[desktop]};
Expand All @@ -176,6 +178,13 @@ const getFontSize = (sizes: ResponsiveFontSize, family: FontFamily) => {
${font[mobileMedium]};
}
`}

${wide &&
css`
${from.wide} {
${font[wide]};
}
`}
`;
};

Expand Down Expand Up @@ -204,15 +213,23 @@ export const WithLink = ({
return <>{children}</>;
};

/**
* headline medium 20 on desktop and headline medium 17 on tablet and mobile
*/
export const defaultFontSizes: ResponsiveFontSize = {
desktop: 'xsmall',
tablet: 'xxsmall',
mobile: 'xxsmall',
};

export const CardHeadline = ({
headlineText,
format,
showQuotes,
kickerText,
showPulsingDot,
hasInlineKicker,
/** headline medium 20 on desktop and headline medium 17 on tablet and mobile */
fontSizes = { desktop: 'xsmall', tablet: 'xxsmall', mobile: 'xxsmall' },
fontSizes = defaultFontSizes,
Comment on lines +216 to +232
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

byline,
showByline,
linkTo,
Expand Down
17 changes: 17 additions & 0 deletions dotcom-rendering/src/components/DecideContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ type Props = {
frontId?: string;
collectionId: number;
containerLevel?: DCRContainerLevel;
isInSlimHomepageAbTestVariant?: boolean;
};

export const DecideContainer = ({
Expand All @@ -62,6 +63,7 @@ export const DecideContainer = ({
frontId,
collectionId,
containerLevel,
isInSlimHomepageAbTestVariant = false,
}: Props) => {
switch (containerType) {
case 'dynamic/fast':
Expand Down Expand Up @@ -244,6 +246,9 @@ export const DecideContainer = ({
imageLoading={imageLoading}
aspectRatio={aspectRatio}
collectionId={collectionId}
isInSlimHomepageAbTestVariant={
isInSlimHomepageAbTestVariant
}
/>
);
case 'flexible/general':
Expand All @@ -257,6 +262,9 @@ export const DecideContainer = ({
aspectRatio={aspectRatio}
containerLevel={containerLevel}
collectionId={collectionId}
isInSlimHomepageAbTestVariant={
isInSlimHomepageAbTestVariant
}
/>
);
case 'scrollable/small':
Expand Down Expand Up @@ -284,6 +292,9 @@ export const DecideContainer = ({
serverTime={serverTime}
aspectRatio={aspectRatio}
sectionId={sectionId}
isInSlimHomepageAbTestVariant={
isInSlimHomepageAbTestVariant
}
/>
</Island>
);
Expand All @@ -296,6 +307,9 @@ export const DecideContainer = ({
serverTime={serverTime}
imageLoading={imageLoading}
aspectRatio={aspectRatio}
isInSlimHomepageAbTestVariant={
isInSlimHomepageAbTestVariant
}
/>
);
case 'scrollable/feature':
Expand All @@ -308,6 +322,9 @@ export const DecideContainer = ({
serverTime={serverTime}
aspectRatio={aspectRatio}
collectionId={collectionId}
isInSlimHomepageAbTestVariant={
isInSlimHomepageAbTestVariant
}
/>
</Island>
);
Expand Down
12 changes: 12 additions & 0 deletions dotcom-rendering/src/components/FlexibleGeneral.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,17 @@ const meta = {
imageLoading: 'eager',
aspectRatio: '5:4',
collectionId: 1,
isInSlimHomepageAbTestVariant: false,
},
render: ({ frontSectionTitle, ...args }) => (
<FrontSection
title={frontSectionTitle}
discussionApiUrl={discussionApiUrl}
editionId="UK"
showTopBorder={true}
slimifySectionForSlimHomepageAbTest={
args.isInSlimHomepageAbTestVariant
}
>
<FlexibleGeneral {...args} />
</FrontSection>
Expand All @@ -193,6 +197,14 @@ export const SplashWithStandards: Story = {
},
};

export const SplashWithStandardsInSlimHomepageAbTest: Story = {
name: 'Splash with big and standard cards in the Slim Homepage AB Test',
args: {
...SplashWithStandards.args,
isInSlimHomepageAbTestVariant: true,
},
};

export const SplashWithSublinks: Story = {
name: 'Standard splash with sublinks',
args: {
Expand Down
Loading
Loading