Skip to content

Commit df6c0a4

Browse files
committed
WIP
1 parent 8ea2760 commit df6c0a4

14 files changed

+247
-26
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ export type Props = {
167167
headlinePosition?: 'inner' | 'outer';
168168
isStorylines?: boolean;
169169
starRatingSize?: RatingSizeType;
170+
isInSlimHomepageAbTestVariant?: boolean;
170171
};
171172

172173
const waveformWrapper = (
@@ -406,6 +407,7 @@ export const Card = ({
406407
isStorylines = false,
407408
starRatingSize = 'small',
408409
articleMedia,
410+
isInSlimHomepageAbTestVariant = false,
409411
}: Props) => {
410412
const hasSublinks = supportingContent && supportingContent.length > 0;
411413
const sublinkPosition = decideSublinkPosition(
@@ -821,6 +823,17 @@ export const Card = ({
821823
);
822824
};
823825

826+
if (
827+
headlineText ===
828+
'Airstrikes hit Iran-Iraq border as US and Israeli plan to mobilise Kurds gathers pace'
829+
) {
830+
console.log(
831+
'Airstrikes sublinksPosition',
832+
sublinkPosition,
833+
isInSlimHomepageAbTestVariant,
834+
);
835+
}
836+
824837
return (
825838
<CardWrapper
826839
format={format}

dotcom-rendering/src/components/CardHeadline.tsx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { css } from '@emotion/react';
22
import {
33
between,
4+
from,
45
headlineMedium14,
56
headlineMedium15,
67
headlineMedium17,
@@ -142,6 +143,7 @@ export enum FontFamily {
142143
export type HeadlineSize = keyof typeof fontFamilies.headlineMedium;
143144

144145
export type ResponsiveFontSize = {
146+
wide?: HeadlineSize;
145147
desktop: HeadlineSize;
146148
tablet?: HeadlineSize;
147149
mobile?: HeadlineSize;
@@ -151,7 +153,7 @@ export type ResponsiveFontSize = {
151153
const getFontSize = (sizes: ResponsiveFontSize, family: FontFamily) => {
152154
const font = fontFamilies[family];
153155

154-
const { desktop, tablet, mobileMedium, mobile } = sizes;
156+
const { wide, desktop, tablet, mobileMedium, mobile } = sizes;
155157

156158
return css`
157159
${font[desktop]};
@@ -176,6 +178,13 @@ const getFontSize = (sizes: ResponsiveFontSize, family: FontFamily) => {
176178
${font[mobileMedium]};
177179
}
178180
`}
181+
182+
${wide &&
183+
css`
184+
${from.wide} {
185+
${font[wide]};
186+
}
187+
`}
179188
`;
180189
};
181190

@@ -204,15 +213,23 @@ export const WithLink = ({
204213
return <>{children}</>;
205214
};
206215

216+
/**
217+
* headline medium 20 on desktop and headline medium 17 on tablet and mobile
218+
*/
219+
export const defaultFontSizes: ResponsiveFontSize = {
220+
desktop: 'xsmall',
221+
tablet: 'xxsmall',
222+
mobile: 'xxsmall',
223+
};
224+
207225
export const CardHeadline = ({
208226
headlineText,
209227
format,
210228
showQuotes,
211229
kickerText,
212230
showPulsingDot,
213231
hasInlineKicker,
214-
/** headline medium 20 on desktop and headline medium 17 on tablet and mobile */
215-
fontSizes = { desktop: 'xsmall', tablet: 'xxsmall', mobile: 'xxsmall' },
232+
fontSizes = defaultFontSizes,
216233
byline,
217234
showByline,
218235
linkTo,

dotcom-rendering/src/components/DecideContainer.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ type Props = {
4747
frontId?: string;
4848
collectionId: number;
4949
containerLevel?: DCRContainerLevel;
50+
isInSlimHomepageAbTestVariant?: boolean;
5051
};
5152

5253
export const DecideContainer = ({
@@ -62,6 +63,7 @@ export const DecideContainer = ({
6263
frontId,
6364
collectionId,
6465
containerLevel,
66+
isInSlimHomepageAbTestVariant = false,
6567
}: Props) => {
6668
switch (containerType) {
6769
case 'dynamic/fast':
@@ -244,6 +246,9 @@ export const DecideContainer = ({
244246
imageLoading={imageLoading}
245247
aspectRatio={aspectRatio}
246248
collectionId={collectionId}
249+
isInSlimHomepageAbTestVariant={
250+
isInSlimHomepageAbTestVariant
251+
}
247252
/>
248253
);
249254
case 'flexible/general':
@@ -257,6 +262,9 @@ export const DecideContainer = ({
257262
aspectRatio={aspectRatio}
258263
containerLevel={containerLevel}
259264
collectionId={collectionId}
265+
isInSlimHomepageAbTestVariant={
266+
isInSlimHomepageAbTestVariant
267+
}
260268
/>
261269
);
262270
case 'scrollable/small':
@@ -284,6 +292,9 @@ export const DecideContainer = ({
284292
serverTime={serverTime}
285293
aspectRatio={aspectRatio}
286294
sectionId={sectionId}
295+
isInSlimHomepageAbTestVariant={
296+
isInSlimHomepageAbTestVariant
297+
}
287298
/>
288299
</Island>
289300
);
@@ -296,6 +307,9 @@ export const DecideContainer = ({
296307
serverTime={serverTime}
297308
imageLoading={imageLoading}
298309
aspectRatio={aspectRatio}
310+
isInSlimHomepageAbTestVariant={
311+
isInSlimHomepageAbTestVariant
312+
}
299313
/>
300314
);
301315
case 'scrollable/feature':
@@ -308,6 +322,9 @@ export const DecideContainer = ({
308322
serverTime={serverTime}
309323
aspectRatio={aspectRatio}
310324
collectionId={collectionId}
325+
isInSlimHomepageAbTestVariant={
326+
isInSlimHomepageAbTestVariant
327+
}
311328
/>
312329
</Island>
313330
);

dotcom-rendering/src/components/FlexibleGeneral.stories.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,15 @@ const meta = {
160160
imageLoading: 'eager',
161161
aspectRatio: '5:4',
162162
collectionId: 1,
163+
isInSlimHomepageAbTestVariant: false,
163164
},
164165
render: ({ frontSectionTitle, ...args }) => (
165166
<FrontSection
166167
title={frontSectionTitle}
167168
discussionApiUrl={discussionApiUrl}
168169
editionId="UK"
169170
showTopBorder={true}
171+
slimifySectionForAbTest={args.isInSlimHomepageAbTestVariant}
170172
>
171173
<FlexibleGeneral {...args} />
172174
</FrontSection>
@@ -193,6 +195,14 @@ export const SplashWithStandards: Story = {
193195
},
194196
};
195197

198+
export const SplashWithStandardsInSlimHomepageAbTest: Story = {
199+
name: 'Splash with big and standard cards in the Slim Homepage AB Test',
200+
args: {
201+
...SplashWithStandards.args,
202+
isInSlimHomepageAbTestVariant: true,
203+
},
204+
};
205+
196206
export const SplashWithSublinks: Story = {
197207
name: 'Standard splash with sublinks',
198208
args: {

0 commit comments

Comments
 (0)