Skip to content

Commit 103aeb8

Browse files
committed
Add dates to multimedia and feature cards, and tweak storyline title
1 parent 8962f9a commit 103aeb8

File tree

8 files changed

+116
-104
lines changed

8 files changed

+116
-104
lines changed

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

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,30 @@ export const Card = ({
519519
css={css`
520520
margin-top: auto;
521521
display: flex;
522+
${SCStyle &&
523+
`
524+
flex-direction: column;
525+
gap: ${space[1]}px;
526+
align-items: flex-start;
527+
`}
522528
`}
523529
>
530+
{/* We add this card footer here because ordinarily, it's either the pill or the footer, but
531+
we need to display the date on these cards if they appear in the storylines section */}
532+
{SCStyle && (
533+
<CardFooter
534+
format={format}
535+
age={decideAge()}
536+
commentCount={<CommentCount />}
537+
cardBranding={
538+
isOnwardContent || !showLabsRedesign ? (
539+
<LabsBranding />
540+
) : undefined
541+
}
542+
showLivePlayable={showLivePlayable}
543+
/>
544+
)}
545+
524546
{isVideoArticle && (
525547
<>
526548
{mainMedia.duration === 0 ? (
@@ -1182,6 +1204,7 @@ export const Card = ({
11821204
flex-grow: 1;
11831205
`}
11841206
>
1207+
{/* why is this needed, sublinks? */}
11851208
{SCStyle && isFlexSplash
11861209
? null
11871210
: headlinePosition === 'inner' && (
@@ -1214,12 +1237,6 @@ export const Card = ({
12141237
}
12151238
showLabsRedesign={showLabsRedesign}
12161239
/>
1217-
{!isUndefined(starRating) ? (
1218-
<StarRatingComponent
1219-
rating={starRating}
1220-
cardHasImage={!!image}
1221-
/>
1222-
) : null}
12231240
</HeadlineWrapper>
12241241
)}
12251242

dotcom-rendering/src/components/FeatureCard.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ export type Props = {
344344
showVideo?: boolean;
345345
/** Feature flag for the labs redesign work */
346346
showLabsRedesign?: boolean;
347+
SCStyle?: boolean;
347348
};
348349

349350
export const FeatureCard = ({
@@ -380,6 +381,7 @@ export const FeatureCard = ({
380381
isImmersive = false,
381382
showVideo = false,
382383
showLabsRedesign = false,
384+
SCStyle = false,
383385
}: Props) => {
384386
const hasSublinks = supportingContent && supportingContent.length > 0;
385387

@@ -667,6 +669,7 @@ export const FeatureCard = ({
667669
}
668670
showClock={!!showClock}
669671
serverTime={serverTime}
672+
SCStyle={SCStyle}
670673
/>
671674
) : undefined
672675
}

dotcom-rendering/src/components/FeatureCardCardAge.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,18 @@ type Props = {
66
showClock: boolean;
77
serverTime?: number;
88
webPublicationDate: string;
9+
SCStyle?: boolean;
910
};
1011

1112
export const FeatureCardCardAge = ({
1213
showClock,
1314
serverTime,
1415
webPublicationDate,
16+
SCStyle,
1517
}: Props) => {
18+
console.log('FeatureCardCardAge webPublicationDate:', webPublicationDate);
1619
const withinTwelveHours = isWithinTwelveHours(webPublicationDate);
17-
if (withinTwelveHours) {
20+
if (withinTwelveHours || SCStyle) {
1821
return (
1922
<CardAge
2023
webPublication={{

dotcom-rendering/src/components/FlexibleGeneral.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ type ImmersiveCardLayoutProps = {
9191
imageLoading: Loading;
9292
collectionId: number;
9393
showLabsRedesign?: boolean;
94+
SCStyle?: boolean;
9495
};
9596

9697
/**
@@ -106,6 +107,7 @@ const ImmersiveCardLayout = ({
106107
imageLoading,
107108
collectionId,
108109
showLabsRedesign,
110+
SCStyle,
109111
}: ImmersiveCardLayoutProps) => {
110112
const isLoopingVideo =
111113
card.mainMedia?.type === 'SelfHostedVideo' &&
@@ -145,6 +147,7 @@ const ImmersiveCardLayout = ({
145147
isImmersive={true}
146148
showVideo={card.showVideo}
147149
showLabsRedesign={showLabsRedesign}
150+
SCStyle={SCStyle}
148151
/>
149152
</LI>
150153
</UL>
@@ -473,6 +476,7 @@ const FullWidthCardLayout = ({
473476
imageLoading={imageLoading}
474477
collectionId={collectionId}
475478
showLabsRedesign={showLabsRedesign}
479+
SCStyle={SCStyle}
476480
/>
477481
);
478482
}

dotcom-rendering/src/components/StorylineSection.tsx

Lines changed: 44 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -359,15 +359,7 @@ const sectionContentBorderFromLeftCol = css`
359359
}
360360
`;
361361

362-
// const sectionBottomContent = css`
363-
// grid-row: bottom-content;
364-
// grid-column: content;
365-
// .hidden > & {
366-
// display: none;
367-
// }
368-
// `;
369-
370-
const sectionTreats = css`
362+
const sectionFooter = css`
371363
/* Mobile: treats appear at the bottom */
372364
grid-row: bottom-content;
373365
grid-column: content;
@@ -411,26 +403,6 @@ const topBorder = css`
411403
border-top-style: solid;
412404
`;
413405

414-
// const bottomPadding = css`
415-
// padding-bottom: ${space[4]}px;
416-
// `;
417-
418-
// const bottomPaddingBetaContainer = (
419-
// useLargeSpacingMobile: boolean,
420-
// useLargeSpacingDesktop: boolean,
421-
// ) => css`
422-
// ${until.tablet} {
423-
// padding-bottom: ${useLargeSpacingMobile
424-
// ? `${space[8]}px`
425-
// : `${space[4]}px`};
426-
// }
427-
// ${from.tablet} {
428-
// padding-bottom: ${useLargeSpacingDesktop
429-
// ? `${space[8]}px`
430-
// : `${space[4]}px`};
431-
// }
432-
// `;
433-
434406
const primaryLevelTopBorder = (
435407
title?: string,
436408
showSectionColours?: boolean,
@@ -541,11 +513,11 @@ const carouselNavigationPlaceholder = css`
541513
*
542514
*/
543515

544-
// largely a copy of front section
545-
// can probably be trimmed down further once we are sure of requirements
546-
// mainly needed for a couple of reasons:
547-
// -- so we can have just the section with the gray background (in frontsection this takes up the full screen width)
548-
// -- so we can tweak the look and positioning of the treat (the "AI use" line) to line up with the bottom of the cards -- todo
516+
/** This is largely a copy of front section (notably re the grid layout), but with some modifications:
517+
* Some text has been added below the title about AI use
518+
* In a frontsection, the background normally takes up the full width of the page, but we want just the section to have the grey background
519+
* A portion of the props and logic in frontsection aren't relevant here
520+
*/
549521
export const StorylineSection = ({
550522
title,
551523
children,
@@ -635,11 +607,6 @@ export const StorylineSection = ({
635607
// only ever having <CPScott> as the leftContent
636608
title?.toLowerCase() === 'opinion',
637609
),
638-
// showVerticalRule &&
639-
// !isBetaContainer &&
640-
// sectionHeadlineFromLeftCol(
641-
// schemePalette('--section-border'),
642-
// ),
643610
]}
644611
>
645612
<FrontSectionTitle
@@ -662,7 +629,7 @@ export const StorylineSection = ({
662629
url={url}
663630
showDateHeader={showDateHeader}
664631
editionId={editionId}
665-
containerLevel={'Secondary'}
632+
containerLevel={'Primary'}
666633
/>
667634
<div
668635
css={css`
@@ -672,7 +639,9 @@ export const StorylineSection = ({
672639
Dive deeper into the Guardian's archive.
673640
This product uses GenAI. Learn more about
674641
how it works{' '}
675-
<a href="https://theguardian.com">here.</a>
642+
<a href="https://www.theguardian.com/help/insideguardian/2023/jun/16/the-guardians-approach-to-generative-ai">
643+
here.
644+
</a>
676645
</div>
677646
</>
678647
}
@@ -711,48 +680,42 @@ export const StorylineSection = ({
711680
{children}
712681
</div>
713682

714-
{treats && (
715-
<div css={[sectionTreats]}>
716-
{/* <Treats
717-
treats={treats}
718-
borderColour={schemePalette('--section-border')}
719-
/> */}
720-
<Footer
721-
dislikeHandler={
722-
dislikeHandler ??
723-
(() =>
724-
submitComponentEvent(
725-
{
726-
component: {
727-
componentType: 'QANDA_ATOM',
728-
id,
729-
products: [],
730-
labels: [],
731-
},
732-
action: 'DISLIKE',
683+
<div css={[sectionFooter]}>
684+
<Footer
685+
dislikeHandler={
686+
dislikeHandler ??
687+
(() =>
688+
submitComponentEvent(
689+
{
690+
component: {
691+
componentType: 'QANDA_ATOM',
692+
id,
693+
products: [],
694+
labels: [],
733695
},
734-
'Web',
735-
))
736-
}
737-
likeHandler={
738-
likeHandler ??
739-
(() =>
740-
submitComponentEvent(
741-
{
742-
component: {
743-
componentType: 'QANDA_ATOM', //todo: update ophan component types to include storyline?
744-
id,
745-
products: [],
746-
labels: [],
747-
},
748-
action: 'LIKE',
696+
action: 'DISLIKE',
697+
},
698+
'Web',
699+
))
700+
}
701+
likeHandler={
702+
likeHandler ??
703+
(() =>
704+
submitComponentEvent(
705+
{
706+
component: {
707+
componentType: 'QANDA_ATOM', //todo: update ophan component types to include storyline?
708+
id,
709+
products: [],
710+
labels: [],
749711
},
750-
'Web',
751-
))
752-
}
753-
></Footer>
754-
</div>
755-
)}
712+
action: 'LIKE',
713+
},
714+
'Web',
715+
))
716+
}
717+
></Footer>
718+
</div>
756719
</section>
757720
</ContainerOverrides>
758721
);

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

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,12 @@ const selectedTitleStyles = css`
8686
color: ${sourcePalette.news[400]};
8787
margin-bottom: ${space[4]}px;
8888
margin-top: ${space[2]}px;
89+
padding-left: 10px; /* aligns with the headlines of the stories below */
8990
`;
9091

9192
const numberStyles = () => css`
9293
${headlineLight50}
94+
line-height: 2rem; /* to align the number with the top of the text */
9395
margin-left: -${space[1]}px;
9496
margin-right: ${space[2]}px;
9597
`;
@@ -219,23 +221,37 @@ export const StorylinesSection = ({
219221
activeStorylineId === storyline.id,
220222
i === 0,
221223
)}
222-
onClick={() =>
223-
setActiveStorylineId(storyline.id)
224-
}
224+
onClick={() => {
225+
console.log(
226+
'clicked storyline',
227+
storyline.id,
228+
);
229+
setActiveStorylineId(storyline.id);
230+
}}
225231
type="button"
226232
>
227233
{activeStorylineId === storyline.id ? (
228-
<span
229-
css={[
230-
numberStyles,
231-
css`
234+
<>
235+
<span
236+
css={[
237+
numberStyles,
238+
css`
239+
color: ${sourcePalette
240+
.neutral[60]};
241+
`,
242+
]}
243+
>
244+
{i + 1}
245+
</span>
246+
<span
247+
css={css`
232248
color: ${sourcePalette
233-
.news[400]};
234-
`,
235-
]}
236-
>
237-
{i + 1}
238-
</span>
249+
.neutral[60]};
250+
`}
251+
>
252+
{storyline.title}
253+
</span>
254+
</>
239255
) : (
240256
<>
241257
<span css={numberStyles}>{i + 1}</span>

dotcom-rendering/src/model/enhanceAITagPageContent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export function parseTPSGContentToStorylines(data: TPSGContent): Storyline[] {
175175
function decideCategoryTitle(category: CategoryContent): string {
176176
switch (category.category) {
177177
case 'Key Stories':
178-
return '';
178+
return 'Key Stories';
179179
case 'Contrasting opinions':
180180
return 'Opinions';
181181
case 'Find multimedia':

dotcom-rendering/src/paletteDeclarations.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2520,8 +2520,14 @@ const cardMetaTextDark: PaletteFunction = () => sourcePalette.neutral[60];
25202520
const cardBackgroundLight: PaletteFunction = () => 'transparent';
25212521
const cardBackgroundDark: PaletteFunction = () => 'transparent';
25222522

2523-
const cardMediaBackgroundLight: PaletteFunction = () =>
2524-
sourcePalette.neutral[97];
2523+
const cardMediaBackgroundLight: PaletteFunction = (format) => {
2524+
switch (format.theme) {
2525+
case ArticleSpecial.SpecialReportAlt:
2526+
return sourcePalette.neutral[93];
2527+
default:
2528+
return sourcePalette.neutral[97];
2529+
}
2530+
};
25252531

25262532
const cardMediaBackgroundDark: PaletteFunction = () =>
25272533
sourcePalette.neutral[20];

0 commit comments

Comments
 (0)