Skip to content

Commit 7900e46

Browse files
committed
Merge branch 'main' into add-gallery-lightbox
2 parents 02fcda5 + 17939b2 commit 7900e46

22 files changed

+328
-248
lines changed

dotcom-rendering/README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,17 @@ $ cd dotcom-rendering
3030

3131
### Install Node.js
3232

33-
To install and manage Node versions, we highly recommend installing a Node version manager such as [fnm](https://github.com/Schniz/fnm) (preferred), [nvm](https://github.com/nvm-sh/nvm) or [asdf](https://asdf-vm.com/guide/getting-started.html).
33+
We highly recommend installing a Node version manager such as [fnm](https://github.com/Schniz/fnm) (preferred), [nvm](https://github.com/nvm-sh/nvm) or [asdf](https://asdf-vm.com/guide/getting-started.html).
3434

35-
Ensure you're at the root directory of this project, then follow the instructions for your version manager to install Node.
35+
Install the Node version manager of your choice.
36+
37+
Ensure you're at the root directory of the project:
38+
39+
```
40+
cd ~/code/dotcom-rendering
41+
```
42+
43+
Run the command for your version manager to use the Node version as specified in [.nvmrc](../.nvmrc).
3644

3745
For `fnm` this will be:
3846

@@ -94,22 +102,20 @@ $ make install
94102

95103
If you get an Node version error then check the setup for your version manager.
96104

97-
### Running locally
105+
### Run
98106

99107
```sh
100108
$ make dev
101109
```
102110

103-
The development server will start on [http://localhost:3030](http://localhost:3030).
111+
The development server will start on [http://localhost:3030](http://localhost:3030)
104112

105-
A list of content types with example URLs are available on the [root path](http://localhost:3030).
113+
The development server home page lists examples of the various page and content types.
106114

107115
You can render a specific article by appending the production URL to the `Article` endpoint, for example:
108-
109116
http://localhost:3030/Article/https://www.theguardian.com/sport/2019/jul/28/tour-de-france-key-moments-egan-bernal-yellow-jersey
110117

111-
You can view the JSON representation of an article as sent to DCR by [Frontend](https://github.com/guardian/frontend), by appending `.json?dcr=true` to the production URL, for example:
112-
118+
You can view the JSON data model of a page as sent by [Frontend](https://github.com/guardian/frontend) to DCR by appending `.json?dcr=true` to the production URL, for example:
113119
https://www.theguardian.com/sport/2019/jul/28/tour-de-france-key-moments-egan-bernal-yellow-jersey.json?dcr=true
114120

115121
### Detailed setup

dotcom-rendering/fixtures/manual/sign-in-gate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const mockAuxiaResponseDismissible = {
88
treatmentContent: JSON.stringify({
99
title: 'Like uninterrupted reading?\nSo do we. Sign in.',
1010
subtitle:
11-
"Sign in to keep reading. It's free, and we'll bring you right back here in under a minute.",
11+
"Sign in to keep reading.\n\nIt's free, and we'll bring you right back here in under a minute.",
1212
body: '',
1313
first_cta_name: 'Create a free account',
1414
first_cta_link: 'https://profile.theguardian.com/register',

dotcom-rendering/src/components/AdSlot.web.tsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ const topAboveNavContainerStyles = css`
115115
display: block;
116116
`;
117117

118-
const topAboveNavContainerVaraintStyles = css`
118+
const topAboveNavContainerVariantStyles = css`
119119
padding-bottom: ${space[5]}px;
120120
position: relative;
121121
margin: 0 auto;
@@ -128,6 +128,25 @@ const topAboveNavContainerVaraintStyles = css`
128128
&[top-above-nav-ad-rendered='true'] {
129129
min-height: auto;
130130
}
131+
132+
/* Ad placeholder grey box rendered while loading the ad */
133+
&:not([top-above-nav-ad-rendered='true']) {
134+
::before {
135+
content: '';
136+
position: absolute;
137+
height: 250px;
138+
width: 728px;
139+
top: ${labelHeight}px;
140+
left: 50%;
141+
transform: translateX(-50%);
142+
background-color: ${palette.neutral[93]};
143+
}
144+
${from.desktop} {
145+
::before {
146+
width: 970px;
147+
}
148+
}
149+
}
131150
`;
132151

133152
/**
@@ -600,7 +619,7 @@ export const AdSlot = ({
600619
<AdSlotWrapper
601620
css={
602621
isIn250ReservationVariant
603-
? topAboveNavContainerVaraintStyles
622+
? topAboveNavContainerVariantStyles
604623
: topAboveNavContainerStyles
605624
}
606625
>

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,9 @@ export const Card = ({
708708
(imagePositionOnMobile === 'bottom' ||
709709
isMediaCard(format)))
710710
}
711-
fillBackgroundOnDesktop={isBetaContainer && isMediaCard(format)}
711+
fillBackgroundOnDesktop={
712+
isBetaContainer && isMediaCardOrNewsletter
713+
}
712714
/>
713715
);
714716

dotcom-rendering/src/components/Carousel.importable.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,10 @@ const getDataLinkNameCarouselButton = (
425425
return `${isVideoContainer ? 'video-container' : arrowName}-${direction}`;
426426
};
427427

428+
const cleanTitle = (title: string) => {
429+
return title.replace('More', '').trimStart();
430+
};
431+
428432
const Title = ({
429433
title,
430434
isCuratedContent,
@@ -453,7 +457,9 @@ const Title = ({
453457
) : (
454458
<h2 css={headerStyles}>
455459
{isCuratedContent ? 'More from ' : ''}
456-
<span css={titleStyle(isCuratedContent)}>{title}</span>
460+
<span css={titleStyle(isCuratedContent)}>
461+
{isCuratedContent ? cleanTitle(title) : title}
462+
</span>
457463
</h2>
458464
);
459465

dotcom-rendering/src/components/DecideContainer.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ type Props = {
4848
frontId?: string;
4949
collectionId: number;
5050
containerLevel?: DCRContainerLevel;
51+
isInNoBoostsAbTestVariant?: boolean;
5152
};
5253

5354
export const DecideContainer = ({
@@ -63,6 +64,7 @@ export const DecideContainer = ({
6364
frontId,
6465
collectionId,
6566
containerLevel,
67+
isInNoBoostsAbTestVariant,
6668
}: Props) => {
6769
switch (containerType) {
6870
case 'dynamic/fast':
@@ -268,6 +270,7 @@ export const DecideContainer = ({
268270
aspectRatio={aspectRatio}
269271
containerLevel={containerLevel}
270272
collectionId={collectionId}
273+
isInNoBoostsAbTestVariant={isInNoBoostsAbTestVariant}
271274
/>
272275
);
273276
case 'scrollable/small':

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

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ const standardCards = standards.map((card, index) => {
5454

5555
switch (index + 1) {
5656
case 2:
57-
return enhanceCardFields({ supportingContent: getSublinks(2) });
57+
return enhanceCardFields({
58+
supportingContent: getSublinks(2),
59+
});
5860
case 3:
5961
return enhanceCardFields({
6062
boostLevel: 'boost',
@@ -437,13 +439,13 @@ const slideshowCard = {
437439
],
438440
} satisfies DCRFrontCard;
439441

440-
export const DefaultSplashWithLiveUpdatesAndSlideshow: Story = {
441-
name: 'Standard splash with live updates and slideshow',
442+
// Boost level is ignored for slideshows
443+
export const SplashWithLiveUpdatesAndSlideshow: Story = {
444+
name: 'Splash with live updates and slideshow',
442445
args: {
443-
frontSectionTitle: 'Standard splash with live updates and slideshow',
446+
frontSectionTitle: 'Splash with live updates and slideshow',
444447
groupedTrails: {
445448
...emptyGroupedTrails,
446-
447449
splash: [{ ...slideshowCard }],
448450
},
449451
},
@@ -460,6 +462,21 @@ export const StandardCards: Story = {
460462
},
461463
};
462464

465+
export const StandardBoostedMediaCardWithSublinks: Story = {
466+
name: 'Standard boosted media card with sublinks',
467+
args: {
468+
frontSectionTitle: 'Standard boosted media card with sublinks',
469+
groupedTrails: {
470+
...emptyGroupedTrails,
471+
standard: [trails[1]].map((card) => ({
472+
...card,
473+
boostLevel: 'boost',
474+
supportingContent: getSublinks(2),
475+
})),
476+
},
477+
},
478+
};
479+
463480
export const OpinionStandardCards: Story = {
464481
name: 'Opinion standard cards',
465482
args: {

dotcom-rendering/src/components/FlexibleGeneral.tsx

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import type { ResponsiveFontSize } from './CardHeadline';
2121
import type { Loading } from './CardPicture';
2222
import { FeatureCard } from './FeatureCard';
2323
import { FrontCard } from './FrontCard';
24+
import { Hide } from './Hide';
2425
import type { Alignment } from './SupportingContent';
2526

2627
type Props = {
@@ -32,6 +33,7 @@ type Props = {
3233
aspectRatio: AspectRatio;
3334
containerLevel?: DCRContainerLevel;
3435
collectionId: number;
36+
isInNoBoostsAbTestVariant?: boolean;
3537
};
3638

3739
type RowLayout = 'oneCardHalfWidth' | 'oneCardFullWidth' | 'twoCard';
@@ -580,17 +582,20 @@ export const FlexibleGeneral = ({
580582
aspectRatio,
581583
containerLevel = 'Primary',
582584
collectionId,
585+
isInNoBoostsAbTestVariant,
583586
}: Props) => {
584587
const splash = [...groupedTrails.splash].slice(0, 1).map((snap) => ({
585588
...snap,
586589
uniqueId: `collection-${collectionId}-splash-0`,
587590
}));
591+
588592
const cards = [...groupedTrails.standard]
589593
.slice(0, 19)
590594
.map((standard, i) => ({
591595
...standard,
592596
uniqueId: `collection-${collectionId}-standard-${i}`,
593597
}));
598+
594599
const groupedCards = decideCardPositions(cards);
595600

596601
return (
@@ -608,11 +613,51 @@ export const FlexibleGeneral = ({
608613
collectionId={collectionId}
609614
/>
610615
)}
611-
612616
{groupedCards.map((row, i) => {
613617
switch (row.layout) {
614618
case 'oneCardFullWidth':
615-
return (
619+
return isInNoBoostsAbTestVariant ? (
620+
<>
621+
<Hide when="above" breakpoint="tablet">
622+
<HalfWidthCardLayout
623+
key={row.cards[0]?.uniqueId}
624+
cards={row.cards}
625+
containerPalette={containerPalette}
626+
showAge={showAge}
627+
absoluteServerTimes={
628+
absoluteServerTimes
629+
}
630+
imageLoading={imageLoading}
631+
isFirstRow={!splash.length && i === 0}
632+
isFirstStandardRow={i === 0}
633+
aspectRatio={aspectRatio}
634+
isLastRow={
635+
i === groupedCards.length - 1
636+
}
637+
containerLevel={containerLevel}
638+
/>
639+
</Hide>
640+
<Hide when="below" breakpoint="tablet">
641+
<FullWidthCardLayout
642+
key={row.cards[0]?.uniqueId}
643+
cards={row.cards}
644+
containerPalette={containerPalette}
645+
showAge={showAge}
646+
absoluteServerTimes={
647+
absoluteServerTimes
648+
}
649+
imageLoading={imageLoading}
650+
aspectRatio={aspectRatio}
651+
isFirstRow={!splash.length && i === 0}
652+
isLastRow={
653+
i === groupedCards.length - 1
654+
}
655+
containerLevel={containerLevel}
656+
collectionId={collectionId}
657+
/>
658+
</Hide>
659+
</>
660+
) : (
616661
<FullWidthCardLayout
617662
key={row.cards[0]?.uniqueId}
618663
cards={row.cards}

0 commit comments

Comments
 (0)