Skip to content

Commit 02c4565

Browse files
authored
Merge branch 'main' into doml/all-boosts
2 parents 5cb0e01 + 45689e1 commit 02c4565

32 files changed

+460
-197
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
/dotcom-rendering/src/client/userFeatures/ @guardian/supporter-revenue-stream
2121
/dotcom-rendering/src/components/AdBlock* @guardian/commercial-dev
2222
/dotcom-rendering/src/components/AdSlot* @guardian/commercial-dev
23+
/dotcom-rendering/src/components/Labs* @guardian/commercial-dev
2324
/dotcom-rendering/src/components/AdP* @guardian/commercial-dev
2425
/dotcom-rendering/src/components/marketing/ @guardian/growth
2526
/dotcom-rendering/src/server/ @guardian/dotcom-platform

apps-rendering/src/components/Callout/calloutComponents.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const Disclaimer = () => (
2222
will only use the data you provide us for the purpose of the feature and
2323
we will delete any personal data when we no longer require it for this
2424
purpose. For true anonymity please use our{' '}
25-
<a href="https://www.theguardian.com/securedrop">SecureDrop</a> service
25+
<a href="https://www.theguardian.com/tips">Secure Messaging</a> service
2626
instead.
2727
</div>
2828
);

apps-rendering/src/components/Callout/calloutContact.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ const Disclaimer = ({ contacts }: { contacts: Contact[] }) => {
7676
</span>
7777
);
7878

79-
const secureDropText = (
79+
const secureMessagingText = (
8080
<span css={[info, calloutLinkContainer]}>
8181
For true anonymity please use our{' '}
82-
<a href="https://www.theguardian.com/securedrop">SecureDrop</a>{' '}
82+
<a href="https://www.theguardian.com/tips">Secure Messaging</a>{' '}
8383
service instead.
8484
</span>
8585
);
@@ -88,7 +88,7 @@ const Disclaimer = ({ contacts }: { contacts: Contact[] }) => {
8888
<>
8989
{contactText}
9090
{contacts.some((c) => !!c.guidance) && guidanceText}{' '}
91-
{secureDropText}
91+
{secureMessagingText}
9292
</>
9393
);
9494
};

dotcom-rendering/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
"@guardian/eslint-config-typescript": "9.0.1",
3939
"@guardian/identity-auth": "6.0.1",
4040
"@guardian/identity-auth-frontend": "8.1.0",
41-
"@guardian/ophan-tracker-js": "2.6.1",
4241
"@guardian/libs": "26.0.0",
42+
"@guardian/ophan-tracker-js": "2.6.1",
4343
"@guardian/react-crossword": "6.3.0",
4444
"@guardian/shimport": "1.0.2",
4545
"@guardian/source": "11.3.0",
@@ -91,7 +91,6 @@
9191
"@types/sanitize-html": "2.11.0",
9292
"@types/scheduler": "0.16.2",
9393
"@types/semver": "7.5.6",
94-
"@types/tough-cookie": "4.0.2",
9594
"@types/trusted-types": "2.0.7",
9695
"@types/twitter-for-web": "0.0.6",
9796
"@types/webpack-bundle-analyzer": "4.7.0",
@@ -105,7 +104,6 @@
105104
"body-parser": "1.20.3",
106105
"browserslist": "4.24.4",
107106
"buffer": "6.0.3",
108-
"chalk": "4.1.2",
109107
"clean-css": "5.3.3",
110108
"compare-versions": "6.1.0",
111109
"compression": "1.7.4",
@@ -162,7 +160,6 @@
162160
"swc-loader": "0.2.6",
163161
"swr": "1.3.0",
164162
"to-string-loader": "1.2.0",
165-
"tough-cookie": "4.1.3",
166163
"trusted-types": "2.0.0",
167164
"ts-loader": "9.5.2",
168165
"ts-unused-exports": "10.1.0",

dotcom-rendering/src/components/ArticleHeadline.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,6 @@ const galleryStyles = css`
398398
399399
grid-row: 7/9;
400400
position: relative;
401-
z-index: ${getZIndex('articleHeadline')};
402401
403402
${from.tablet} {
404403
${grid.between('centre-column-start', 'grid-end')};

dotcom-rendering/src/components/Callout/CalloutComponents.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,9 @@ export const CalloutTermsAndConditions = () => (
219219
purpose. For true anonymity please use our{' '}
220220
<a
221221
data-ignore="global-link-styling"
222-
href="https://www.theguardian.com/securedrop"
222+
href="https://www.theguardian.com/tips"
223223
>
224-
SecureDrop
224+
Secure Messaging
225225
</a>{' '}
226226
service instead.
227227
</div>

dotcom-rendering/src/components/Callout/MessageUs.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ const Disclaimer = ({ contacts }: { contacts: CalloutContactType[] }) => {
9494
</span>
9595
);
9696

97-
const secureDropText = (
97+
const secureMessagingText = (
9898
<span>
9999
For true anonymity please use our{' '}
100-
<a href="https://www.theguardian.com/securedrop">SecureDrop</a>{' '}
100+
<a href="https://www.theguardian.com/tips">Secure Messaging</a>{' '}
101101
service instead.
102102
</span>
103103
);
@@ -107,7 +107,7 @@ const Disclaimer = ({ contacts }: { contacts: CalloutContactType[] }) => {
107107
{contactText}
108108
<p css={[linkStyles, infoStyles]}>
109109
{contacts.some((c) => !!c.guidance) && guidanceText}{' '}
110-
{secureDropText}
110+
{secureMessagingText}
111111
</p>
112112
</>
113113
);

dotcom-rendering/src/components/Caption.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ const galleryStyles = css`
230230
padding-bottom: 6px;
231231
${from.leftCol} {
232232
${grid.column.left}
233-
grid-row-start: 8;
233+
grid-row: 8/10;
234234
}
235235
${between.tablet.and.leftCol} {
236236
position: relative;

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

Lines changed: 91 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { css } from '@emotion/react';
22
import { isUndefined } from '@guardian/libs';
33
import {
4+
between,
45
from,
56
palette as sourcePalette,
67
space,
8+
until,
79
} from '@guardian/source/foundations';
810
import { Hide, Link, SvgCamera } from '@guardian/source/react-components';
911
import {
@@ -15,6 +17,7 @@ import { isMediaCard } from '../../lib/cardHelpers';
1517
import { isWithinTwelveHours, secondsToDuration } from '../../lib/formatTime';
1618
import { appendLinkNameMedia } from '../../lib/getDataLinkName';
1719
import { getZIndex } from '../../lib/getZIndex';
20+
import { getOphanComponents } from '../../lib/labs';
1821
import { DISCUSSION_ID_DATA_ATTRIBUTE } from '../../lib/useCommentCount';
1922
import { BETA_CONTAINERS } from '../../model/enhanceCollections';
2023
import { palette } from '../../palette';
@@ -43,6 +46,7 @@ import { Pill } from '../Pill';
4346
import { SlideshowCarousel } from '../SlideshowCarousel.importable';
4447
import { Snap } from '../Snap';
4548
import { SnapCssSandbox } from '../SnapCssSandbox';
49+
import { SponsoredContentLabel } from '../SponsoredContentLabel';
4650
import { StarRating } from '../StarRating/StarRating';
4751
import type { Alignment } from '../SupportingContent';
4852
import { SupportingContent } from '../SupportingContent';
@@ -731,6 +735,80 @@ export const Card = ({
731735
return undefined;
732736
};
733737

738+
/**
739+
* Decides which branding design to apply based on the labs redesign feature switch
740+
* Adds appropriate Ophan data attributes based on card context
741+
* Results in a clickable brand logo and sponsorship label
742+
*/
743+
const LabsBranding = () => {
744+
if (!branding) return;
745+
const getLocationPrefix = () => {
746+
if (!onwardsSource) {
747+
return 'front-card';
748+
}
749+
if (onwardsSource === 'related-content') {
750+
return 'article-related-content';
751+
} else {
752+
return undefined;
753+
}
754+
};
755+
const locationPrefix = getLocationPrefix();
756+
const dataAttributes = locationPrefix
757+
? getOphanComponents({
758+
branding,
759+
locationPrefix,
760+
})
761+
: undefined;
762+
763+
return showLabsRedesign ? (
764+
<>
765+
{/** All screen sizes apart from tablet have horizontal orientation */}
766+
<div
767+
css={css`
768+
${between.tablet.and.desktop} {
769+
display: none;
770+
}
771+
`}
772+
>
773+
<SponsoredContentLabel
774+
branding={branding}
775+
containerPalette={containerPalette}
776+
orientation="horizontal"
777+
alignment="end"
778+
ophanComponentLink={dataAttributes?.ophanComponentLink}
779+
ophanComponentName={dataAttributes?.ophanComponentName}
780+
/>
781+
</div>
782+
{/** Tablet sized screens have vertical orientation */}
783+
<div
784+
css={css`
785+
${until.tablet} {
786+
display: none;
787+
}
788+
${from.desktop} {
789+
display: none;
790+
}
791+
`}
792+
>
793+
<SponsoredContentLabel
794+
branding={branding}
795+
containerPalette={containerPalette}
796+
orientation="vertical"
797+
alignment="end"
798+
ophanComponentLink={dataAttributes?.ophanComponentLink}
799+
ophanComponentName={dataAttributes?.ophanComponentName}
800+
/>
801+
</div>
802+
</>
803+
) : (
804+
<CardBranding
805+
branding={branding}
806+
containerPalette={containerPalette}
807+
onwardsSource={onwardsSource}
808+
/>
809+
);
810+
};
811+
734812
return (
735813
<CardWrapper
736814
format={format}
@@ -1127,17 +1205,10 @@ export const Card = ({
11271205
{showPill ? (
11281206
<>
11291207
<MediaOrNewsletterPill />
1130-
{format.theme === ArticleSpecial.Labs &&
1131-
branding && (
1132-
<CardBranding
1133-
branding={branding}
1134-
onwardsSource={
1135-
onwardsSource
1136-
}
1137-
containerPalette={
1138-
containerPalette
1139-
}
1140-
/>
1208+
{!showLabsRedesign &&
1209+
format.theme ===
1210+
ArticleSpecial.Labs && (
1211+
<LabsBranding />
11411212
)}
11421213
</>
11431214
) : (
@@ -1146,16 +1217,9 @@ export const Card = ({
11461217
age={decideAge()}
11471218
commentCount={<CommentCount />}
11481219
cardBranding={
1149-
branding ? (
1150-
<CardBranding
1151-
branding={branding}
1152-
onwardsSource={
1153-
onwardsSource
1154-
}
1155-
containerPalette={
1156-
containerPalette
1157-
}
1158-
/>
1220+
isOnwardContent ||
1221+
!showLabsRedesign ? (
1222+
<LabsBranding />
11591223
) : undefined
11601224
}
11611225
showLivePlayable={showLivePlayable}
@@ -1205,6 +1269,7 @@ export const Card = ({
12051269
</ContentWrapper>
12061270
</CardLayout>
12071271

1272+
{/** This div contains content that sits "outside" of the standard card layout */}
12081273
<div
12091274
css={
12101275
/** We allow this area to take up more space so that cards without
@@ -1249,12 +1314,7 @@ export const Card = ({
12491314
age={decideAge()}
12501315
commentCount={<CommentCount />}
12511316
cardBranding={
1252-
branding ? (
1253-
<CardBranding
1254-
branding={branding}
1255-
onwardsSource={onwardsSource}
1256-
/>
1257-
) : undefined
1317+
!showLabsRedesign ? <LabsBranding /> : undefined
12581318
}
12591319
showLivePlayable={showLivePlayable}
12601320
shouldReserveSpace={{
@@ -1264,6 +1324,10 @@ export const Card = ({
12641324
/>
12651325
)}
12661326
</div>
1327+
1328+
{showLabsRedesign &&
1329+
!isOnwardContent &&
1330+
format.theme === ArticleSpecial.Labs && <LabsBranding />}
12671331
</CardWrapper>
12681332
);
12691333
};

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
visuallyHidden,
66
} from '@guardian/source/foundations';
77
import { useConfig } from '../../../components/ConfigContext';
8-
import { decideCardLogo } from '../../../lib/decideLogo';
8+
import { decideBrandingLogo } from '../../../lib/decideLogo';
99
import { getZIndex } from '../../../lib/getZIndex';
1010
import { getOphanComponents } from '../../../lib/labs';
1111
import { palette as themePalette } from '../../../palette';
@@ -48,7 +48,7 @@ export const CardBranding = ({
4848
onwardsSource,
4949
containerPalette,
5050
}: Props) => {
51-
const logo = decideCardLogo(branding, containerPalette);
51+
const logo = decideBrandingLogo(branding, containerPalette);
5252

5353
const { darkModeAvailable } = useConfig();
5454

@@ -83,6 +83,7 @@ export const CardBranding = ({
8383
data-testid="card-branding-logo"
8484
data-component={dataAttributes?.ophanComponentName}
8585
data-link-name={dataAttributes?.ophanComponentLink}
86+
className="branding-logo"
8687
>
8788
<picture>
8889
{darkModeAvailable && branding.logoForDarkBackground && (

0 commit comments

Comments
 (0)