Skip to content

Commit c1b0527

Browse files
committed
wip2
1 parent b7c4250 commit c1b0527

File tree

5 files changed

+113
-47
lines changed

5 files changed

+113
-47
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ import {
44
space,
55
textSans14,
66
textSans17,
7+
textSans20,
78
} from '@guardian/source/foundations';
89
import { Hide } from '@guardian/source/react-components';
910
import { palette } from '../../../palette';
1011

11-
export type TrailTextSize = 'regular' | 'large';
12+
export type TrailTextSize = 'regular' | 'large' | 'xlarge';
1213

1314
const trailTextStyles = css`
1415
display: flex;
@@ -27,6 +28,7 @@ const fontStyles = (trailTextSize: TrailTextSize) => css`
2728
${textSans14}
2829
${from.desktop} {
2930
${trailTextSize === 'large' && textSans17}
31+
${trailTextSize === 'xlarge' && textSans20}
3032
}
3133
strong {
3234
font-weight: bold;
@@ -54,12 +56,16 @@ export const TrailText = ({
5456
padBottom = true,
5557
padTop = false,
5658
}: Props) => {
59+
const effectiveColour =
60+
trailTextSize === 'xlarge'
61+
? palette('--card-headline')
62+
: trailTextColour;
5763
const trailText = (
5864
<div
5965
css={[
6066
trailTextStyles,
6167
css`
62-
color: ${trailTextColour};
68+
color: ${effectiveColour};
6369
`,
6470
fontStyles(trailTextSize),
6571
padBottom && bottomPadding,

dotcom-rendering/src/components/FlexibleSpecial.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ type Props = {
3232
containerLevel?: DCRContainerLevel;
3333
collectionId: number;
3434
showLabsRedesign?: boolean;
35+
SCStyle?: boolean;
3536
};
3637

3738
type BoostProperties = {
@@ -54,6 +55,7 @@ const determineCardProperties = (
5455
supportingContentLength: number,
5556
mediaCard: boolean,
5657
imageSuppressed: boolean,
58+
SCStyle: boolean,
5759
): BoostProperties => {
5860
switch (boostLevel) {
5961
// The default boost level is equal to no boost. It is the same as the default card layout.
@@ -134,6 +136,7 @@ type OneCardLayoutProps = {
134136
containerLevel: DCRContainerLevel;
135137
isSplashCard?: boolean;
136138
showLabsRedesign?: boolean;
139+
SCStyle?: boolean;
137140
};
138141

139142
export const OneCardLayout = ({
@@ -148,6 +151,7 @@ export const OneCardLayout = ({
148151
containerLevel,
149152
isSplashCard,
150153
showLabsRedesign,
154+
SCStyle = false,
151155
}: OneCardLayoutProps) => {
152156
const card = cards[0];
153157
if (!card) return null;
@@ -166,6 +170,7 @@ export const OneCardLayout = ({
166170
card.supportingContent?.length ?? 0,
167171
isMediaCard(card.format),
168172
!card.image,
173+
SCStyle,
169174
);
170175

171176
return (
@@ -231,6 +236,7 @@ type TwoOrFourCardLayoutProps = {
231236
containerLevel: DCRContainerLevel;
232237
/** Feature flag for the labs redesign work */
233238
showLabsRedesign?: boolean;
239+
SCStyle: boolean;
234240
};
235241

236242
const TwoOrFourCardLayout = ({
@@ -244,12 +250,13 @@ const TwoOrFourCardLayout = ({
244250
isFirstRow,
245251
containerLevel,
246252
showLabsRedesign,
253+
SCStyle,
247254
}: TwoOrFourCardLayoutProps) => {
248255
if (cards.length === 0) return null;
249256
const hasTwoOrFewerCards = cards.length <= 2;
250257

251258
return (
252-
<UL direction="row" showTopBar={true}>
259+
<UL direction="row" showTopBar={!SCStyle}>
253260
{cards.map((card, cardIndex) => {
254261
return (
255262
<LI
@@ -305,6 +312,7 @@ export const FlexibleSpecial = ({
305312
containerLevel = 'Primary',
306313
collectionId,
307314
showLabsRedesign,
315+
SCStyle = false,
308316
}: Props) => {
309317
const snaps = [...groupedTrails.snap].slice(0, 1).map((snap) => ({
310318
...snap,
@@ -349,6 +357,7 @@ export const FlexibleSpecial = ({
349357
containerLevel={containerLevel}
350358
isSplashCard={true}
351359
showLabsRedesign={showLabsRedesign}
360+
SCStyle={SCStyle}
352361
/>
353362
)}
354363

@@ -362,6 +371,7 @@ export const FlexibleSpecial = ({
362371
isFirstRow={!isNonEmptyArray(snaps) && !isNonEmptyArray(splash)}
363372
containerLevel={containerLevel}
364373
showLabsRedesign={showLabsRedesign}
374+
SCStyle={SCStyle}
365375
/>
366376
</>
367377
);

dotcom-rendering/src/components/StorylineSection.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,6 @@ const sectionContentBorderFromLeftCol = css`
370370
position: absolute;
371371
top: ${space[2]}px;
372372
bottom: 0;
373-
border-left: 1px solid ${schemePalette('--section-border')};
374373
transform: translateX(-50%);
375374
/** Keeps the vertical divider ontop of carousel item dividers */
376375
z-index: 1;
@@ -390,6 +389,7 @@ const sectionTreats = css`
390389
display: none;
391390
392391
${from.leftCol} {
392+
padding-bottom: ${space[3]}px;
393393
display: block;
394394
align-self: end;
395395
@@ -426,7 +426,7 @@ const topBorder = css`
426426
`;
427427

428428
const bottomPadding = css`
429-
padding-bottom: ${space[9]}px;
429+
padding-bottom: ${space[6]}px;
430430
`;
431431

432432
const bottomPaddingBetaContainer = (
@@ -681,7 +681,7 @@ export const StorylineSection = ({
681681
url={url}
682682
showDateHeader={showDateHeader}
683683
editionId={editionId}
684-
containerLevel={containerLevel}
684+
containerLevel={'Secondary'}
685685
/>
686686
}
687687
collectionBranding={collectionBranding}

dotcom-rendering/src/components/StorylineTabContent.tsx

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,36 @@ import { FlexibleGeneral } from './FlexibleGeneral';
33
import { FlexibleSpecial } from './FlexibleSpecial';
44
import { css } from '@emotion/react';
55
import { palette } from '../palette';
6+
import {
7+
space,
8+
palette as sourcePalette,
9+
textSans20,
10+
from,
11+
} from '@guardian/source/foundations';
612
import { Category } from './StorylinesSection.importable';
713

814
const categoryTitleCss = css`
9-
fontsize: 20px;
10-
fontweight: 700;
11-
color: #ab0613;
12-
margin: 4px;
13-
padding: 8px;
14-
border-top: 1px solid ${palette('--section-border-primary')};
15+
${textSans20};
16+
font-weight: 700;
17+
color: ${sourcePalette.news[300]};
18+
padding: ${space[2]}px 0;
19+
${from.tablet} {
20+
padding: 10px;
21+
}
22+
23+
border-top: 1px solid ${palette('--section-border-secondary')};
24+
`;
25+
26+
const contentCss = css`
27+
margin-bottom: ${space[4]}px;
28+
${from.leftCol} {
29+
border-left: 1px solid ${sourcePalette.neutral[86]};
30+
}
1531
`;
1632

1733
export const StorylineTabContent = ({ content }: { content: Category[] }) => {
1834
// key stories - flexible general, megaboosted first standard card
19-
// other categories - flex gen
35+
// other categories - flex gen secondary
2036
// explainers/multimedia with default
2137
// opinion with default boost and design 8 (comment)
2238
// deep reads/profiles with contents->display->is immersive true
@@ -35,6 +51,7 @@ export const StorylineTabContent = ({ content }: { content: Category[] }) => {
3551
imageLoading={'eager'}
3652
aspectRatio={'5:4'}
3753
collectionId={0}
54+
SCStyle={true}
3855
/>
3956
);
4057
case 'flexible/general':
@@ -44,6 +61,7 @@ export const StorylineTabContent = ({ content }: { content: Category[] }) => {
4461
imageLoading={'eager'}
4562
aspectRatio={'5:4'}
4663
collectionId={0}
64+
containerLevel="Secondary"
4765
/>
4866
);
4967
default:
@@ -58,7 +76,7 @@ export const StorylineTabContent = ({ content }: { content: Category[] }) => {
5876
return (
5977
<>
6078
{content.map((category, idx) => (
61-
<div key={idx}>
79+
<div key={idx} css={contentCss}>
6280
{category.title !== 'Key Stories' && (
6381
<h2 css={categoryTitleCss}>{category.title}</h2>
6482
)}

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

Lines changed: 65 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
import { TagPage } from 'src/types/tagPage';
2-
import { space } from '@guardian/source/foundations';
3-
import { palette } from '../palette';
2+
import { from } from '@guardian/source/foundations';
43
import { css } from '@emotion/react';
54
import { useState } from 'react';
65
import { DCRFrontCard, DCRGroupedTrails, TreatType } from 'src/types/front';
76
import { StorylineTabContent } from './StorylineTabContent';
87
import { StorylineSection } from './StorylineSection';
8+
import {
9+
space,
10+
palette as sourcePalette,
11+
textSans17,
12+
} from '@guardian/source/foundations';
13+
import { ScrollableCarousel } from './ScrollableCarousel';
914

1015
type Storyline = {
1116
id: string;
@@ -29,31 +34,34 @@ type StorylinesSectionProps = {
2934

3035
const tabsContainerStyles = css`
3136
display: flex;
32-
gap: ${space[2]}px;
33-
border-bottom: 1px solid ${palette('--section-border-primary')};
34-
margin-bottom: ${space[4]}px;
37+
width: 100%;
38+
align-items: stretch; /* Makes all tabs the same height */
39+
margin-bottom: ${space[2]}px;
40+
margin-left: -${space[2]}px; /* on mobile at least */
3541
`;
3642

37-
const tabStyles = (isActive: boolean) => css`
38-
background: none;
39-
border: none;
40-
padding: ${space[2]}px ${space[3]}px;
43+
const tabStyles = (isActive: boolean, isFirst: boolean) => css`
44+
${textSans17};
45+
font-weight: 700;
46+
text-align: start;
47+
padding: ${space[0]}px ${space[0]}px ${space[0]}px ${space[2]}px;
4148
cursor: pointer;
42-
border-bottom: ${isActive
43-
? `4px solid ${palette('--section-border-primary')}`
44-
: 'none'};
45-
font-weight: ${isActive ? 'bold' : 'normal'};
49+
border: none;
50+
${!isFirst && `border-left: 1px ${sourcePalette.neutral[86]} solid;`}
4651
color: ${isActive
47-
? `${palette('--section-border-news')}`
48-
: `${palette('--section-border-primary')}`};
49-
50-
&:hover {
51-
color: ${palette('--section-border-news')};
52-
}
52+
? `${sourcePalette.news[400]}`
53+
: `${sourcePalette.neutral[38]}`};
54+
flex: 1;
55+
min-width: 0;
56+
display: flex;
57+
align-items: flex-start; /* Aligns text to the top of each tab */
5358
`;
59+
// &:hover {
60+
// color: ${palette('--section-border-news')};
61+
// }
5462

5563
const contentStyles = css`
56-
padding: ${space[3]}px 0;
64+
padding-top: ${space[0]}px 0;
5765
`;
5866

5967
// importable because we need js to handle the tabs
@@ -77,7 +85,7 @@ export const StorylinesSection = ({
7785
{
7886
format: { design: 0, display: 0, theme: 0 },
7987
dataLinkName: 'news | group-0 | card-@1',
80-
url: '/uk-news/2025/oct/31/andrew-in-line-for-six-figure-payment-and-annual-stipend-from-king-sources-say',
88+
url: '',
8189
headline: '',
8290
trailText:
8391
'The former prince remains under scrutiny as Buckingham Palace finalises plans for his future as a commoner',
@@ -620,12 +628,22 @@ export const StorylinesSection = ({
620628
const testStorylines: Storyline[] = [
621629
{
622630
id: 'storyline-1',
623-
title: 'Storyline 1',
631+
title: 'Russian drone incursions in NATO airspace',
624632
categories: categories1Test,
625633
},
626634
{
627635
id: 'storyline-2',
628-
title: 'Storyline 2',
636+
title: 'Zaporizhzhia nuclear plant power crisis',
637+
categories: categories2Test,
638+
},
639+
{
640+
id: 'storyline-3',
641+
title: 'Ukrainian energy infrastructure under sustained Russian attack',
642+
categories: categories2Test,
643+
},
644+
{
645+
id: 'storyline-4',
646+
title: `Trump's evolving approach to ending the war`,
629647
categories: categories2Test,
630648
},
631649
];
@@ -681,16 +699,30 @@ export const StorylinesSection = ({
681699
>
682700
{/* Tab selector */}
683701
<div css={tabsContainerStyles}>
684-
{testStorylines.map((storyline) => (
685-
<button
686-
key={storyline.id}
687-
css={tabStyles(activeStorylineId === storyline.id)}
688-
onClick={() => setActiveStorylineId(storyline.id)}
689-
type="button"
690-
>
691-
{storyline.title}
692-
</button>
693-
))}
702+
<ScrollableCarousel
703+
carouselLength={Math.ceil(testStorylines.length / 2)}
704+
visibleCarouselSlidesOnMobile={2}
705+
visibleCarouselSlidesOnTablet={4}
706+
sectionId={'sectionId'}
707+
shouldStackCards={{ desktop: false, mobile: false }}
708+
gapSizes={{ column: 'large', row: 'medium' }}
709+
>
710+
{testStorylines.map((storyline, index) => (
711+
<button
712+
key={storyline.id}
713+
css={tabStyles(
714+
activeStorylineId === storyline.id,
715+
index === 0,
716+
)}
717+
onClick={() =>
718+
setActiveStorylineId(storyline.id)
719+
}
720+
type="button"
721+
>
722+
{storyline.title}
723+
</button>
724+
))}
725+
</ScrollableCarousel>
694726
</div>
695727

696728
{/* Tabs content */}

0 commit comments

Comments
 (0)