Skip to content

Commit 55c5ed0

Browse files
authored
Merge pull request #14513 from guardian/dina/update-labsSection-to-not-use-containeroverride
Update the `LabsSection` to stop using `ContainerOverrides`
2 parents bead368 + 7ae41b3 commit 55c5ed0

File tree

1 file changed

+94
-86
lines changed

1 file changed

+94
-86
lines changed

dotcom-rendering/src/components/LabsSection.tsx

Lines changed: 94 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import { palette } from '../palette';
2121
import LabsLogo from '../static/logos/the-guardian-labs.svg';
2222
import type { DCRBadgeType } from '../types/badge';
2323
import { Badge } from './Badge';
24-
import { ContainerOverrides } from './ContainerOverrides';
2524
import { Details } from './Details';
2625
import { Island } from './Island';
2726
import { Section } from './Section';
@@ -75,11 +74,17 @@ type Props = {
7574
};
7675

7776
const leftColumnBackground = css`
78-
background-color: ${palette('--section-background-left')};
77+
background-color: ${sourcePalette.labs[400]};
78+
@media (prefers-color-scheme: dark) {
79+
background-color: ${sourcePalette.labs[200]};
80+
}
7981
`;
8082

8183
const contentBackground = css`
82-
background-color: ${palette('--section-background')};
84+
background-color: ${sourcePalette.neutral[93]};
85+
@media (prefers-color-scheme: dark) {
86+
background-color: ${sourcePalette.neutral[20]};
87+
}
8388
`;
8489

8590
const leftColumnWidthFromLeftCol = css`
@@ -167,7 +172,10 @@ const contentSidePaddingFromLeftCol = css`
167172

168173
const linkStyles = css`
169174
text-decoration: none;
170-
color: ${palette('--article-section-title')};
175+
color: ${sourcePalette.neutral[100]};
176+
@media (prefers-color-scheme: dark) {
177+
color: ${sourcePalette.neutral[97]};
178+
}
171179
172180
:hover {
173181
text-decoration: underline;
@@ -176,8 +184,11 @@ const linkStyles = css`
176184

177185
const headerStyles = css`
178186
${textSansBold20};
179-
color: ${palette('--article-section-title')};
187+
color: ${sourcePalette.neutral[100]};
180188
overflow-wrap: break-word; /*if a single word is too long, this will break the word up rather than have the display be affected*/
189+
@media (prefers-color-scheme: dark) {
190+
color: ${sourcePalette.neutral[97]};
191+
}
181192
`;
182193

183194
const containerMargins = css`
@@ -195,9 +206,12 @@ const badgeStyles = css`
195206

196207
const paidForByStyles = css`
197208
${textSansBold12};
198-
color: ${palette('--treat-text')};
209+
color: ${sourcePalette.neutral[46]};
199210
margin-top: ${space[3]}px;
200211
margin-bottom: ${space[1]}px;
212+
@media (prefers-color-scheme: dark) {
213+
color: ${sourcePalette.neutral[38]};
214+
}
201215
`;
202216

203217
const GuardianLabsTitle = ({ title, url }: { title: string; url?: string }) => {
@@ -379,87 +393,81 @@ export const LabsSection = ({
379393
editionId,
380394
}: Props) => {
381395
return (
382-
<ContainerOverrides containerPalette="Branded">
383-
<Section
384-
fullWidth={true}
385-
sectionId={sectionId}
386-
padSides={false}
387-
element="section"
388-
containerName={containerName}
389-
ophanComponentLink={ophanComponentLink}
390-
ophanComponentName={ophanComponentName}
391-
hasPageSkin={hasPageSkin}
392-
borderColour={palette('--section-border')}
393-
backgroundColour="transparent"
394-
/**
395-
* dumathoin?
396-
* https://github.com/guardian/frontend/pull/17625
397-
* https://forgottenrealms.fandom.com/wiki/Dumathoin
398-
*/
399-
className={'dumathoin'}
400-
>
401-
<Container hasPageSkin={hasPageSkin}>
402-
<LeftColumn hasPageSkin={hasPageSkin}>
403-
<div>
404-
<LabsContainerHeader
405-
summaryBackgroundColour={
406-
sourcePalette.neutral[0]
407-
}
408-
summaryTextColour={sourcePalette.neutral[97]}
409-
summaryTextSecondaryColour={
410-
sourcePalette.labs[400]
411-
}
412-
hasPageSkin={hasPageSkin}
396+
<Section
397+
fullWidth={true}
398+
sectionId={sectionId}
399+
padSides={false}
400+
element="section"
401+
containerName={containerName}
402+
ophanComponentLink={ophanComponentLink}
403+
ophanComponentName={ophanComponentName}
404+
hasPageSkin={hasPageSkin}
405+
borderColour={palette('--section-border')}
406+
backgroundColour="transparent"
407+
/**
408+
* dumathoin?
409+
* https://github.com/guardian/frontend/pull/17625
410+
* https://forgottenrealms.fandom.com/wiki/Dumathoin
411+
*/
412+
className={'dumathoin'}
413+
>
414+
<Container hasPageSkin={hasPageSkin}>
415+
<LeftColumn hasPageSkin={hasPageSkin}>
416+
<div>
417+
<LabsContainerHeader
418+
summaryBackgroundColour={sourcePalette.neutral[0]}
419+
summaryTextColour={sourcePalette.neutral[97]}
420+
summaryTextSecondaryColour={sourcePalette.labs[400]}
421+
hasPageSkin={hasPageSkin}
422+
/>
423+
<GuardianLabsTitle title={title} url={url} />
424+
</div>
425+
426+
<Link
427+
href={`https://www.theguardian.com/guardian-labs${getLabsUrlSuffix(
428+
editionId,
429+
)}`}
430+
cssOverrides={css`
431+
text-align: right;
432+
`}
433+
>
434+
<LabsLogo />
435+
</Link>
436+
</LeftColumn>
437+
<Content hasPageSkin={hasPageSkin}>
438+
{children}
439+
{canShowMore && (
440+
<Island
441+
priority="feature"
442+
defer={{ until: 'interaction' }}
443+
>
444+
<ShowMore
445+
title={title}
446+
sectionId={sectionId}
447+
collectionId={collectionId}
448+
pageId={pageId}
449+
ajaxUrl={ajaxUrl}
450+
containerPalette={'Branded'}
451+
showAge={true}
452+
discussionApiUrl={discussionApiUrl}
453+
editionId={editionId}
454+
/>
455+
</Island>
456+
)}
457+
{badge && (
458+
<div css={badgeStyles}>
459+
<div css={paidForByStyles}>Paid for by</div>
460+
<Badge
461+
imageSrc={badge.imageSrc}
462+
href={badge.href}
463+
ophanComponentLink={`labs-logo | ${ophanComponentName}`}
464+
ophanComponentName={`labs-logo-${ophanComponentName}`}
465+
isInLabsSection={true}
413466
/>
414-
<GuardianLabsTitle title={title} url={url} />
415467
</div>
416-
417-
<Link
418-
href={`https://www.theguardian.com/guardian-labs${getLabsUrlSuffix(
419-
editionId,
420-
)}`}
421-
cssOverrides={css`
422-
text-align: right;
423-
`}
424-
>
425-
<LabsLogo />
426-
</Link>
427-
</LeftColumn>
428-
<Content hasPageSkin={hasPageSkin}>
429-
{children}
430-
{canShowMore && (
431-
<Island
432-
priority="feature"
433-
defer={{ until: 'interaction' }}
434-
>
435-
<ShowMore
436-
title={title}
437-
sectionId={sectionId}
438-
collectionId={collectionId}
439-
pageId={pageId}
440-
ajaxUrl={ajaxUrl}
441-
containerPalette={'Branded'}
442-
showAge={true}
443-
discussionApiUrl={discussionApiUrl}
444-
editionId={editionId}
445-
/>
446-
</Island>
447-
)}
448-
{badge && (
449-
<div css={badgeStyles}>
450-
<div css={paidForByStyles}>Paid for by</div>
451-
<Badge
452-
imageSrc={badge.imageSrc}
453-
href={badge.href}
454-
ophanComponentLink={`labs-logo | ${ophanComponentName}`}
455-
ophanComponentName={`labs-logo-${ophanComponentName}`}
456-
isInLabsSection={true}
457-
/>
458-
</div>
459-
)}
460-
</Content>
461-
</Container>
462-
</Section>
463-
</ContainerOverrides>
468+
)}
469+
</Content>
470+
</Container>
471+
</Section>
464472
);
465473
};

0 commit comments

Comments
 (0)