Skip to content

Commit a076e49

Browse files
committed
more tidy
1 parent cc8f23b commit a076e49

File tree

6 files changed

+33
-43
lines changed

6 files changed

+33
-43
lines changed

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,9 @@ export const Card = ({
519519
`}
520520
`}
521521
>
522-
{/* Ordinarily, it's either the pill or the footer, but we want to display the date on these cards
523-
if they appear in the storylines section on tag pages.
522+
{/* Usually, we either display the pill or the footer,
523+
but if the card appears in the storylines section on tag pages
524+
then we do want to display the date on these cards as well as the media pill.
524525
*/}
525526
{storylinesStyle && (
526527
<CardFooter
@@ -765,7 +766,7 @@ export const Card = ({
765766
<SupportingKeyStoriesContent
766767
supportingContent={supportingContent}
767768
containerPalette={containerPalette}
768-
alignment={supportingContentAlignment}
769+
alignment="vertical"
769770
isMedia={isMediaCard(format)}
770771
fillBackgroundOnMobile={false}
771772
fillBackgroundOnDesktop={
@@ -1250,12 +1251,12 @@ export const Card = ({
12501251
isOnwardContent,
12511252
)}
12521253
>
1253-
{/* This div is needed to keep the headline and trail text justified at the start */}
12541254
{/* In the storylines section on tag pages, the flex splash is used to display key stories.
1255-
This is shown as a large image taken from the first article in the group, and the headlines of the first four key articles (include that of the first article).
1256-
Therefore, we don't display an article headline in the conventional sense, these are displayed as "supporting content".
1257-
However, simply passing an empty string as the article headline still reserves space, so this check enables us to avoid rendering that space at all.
1258-
*/}
1255+
We don't display an article headline in the conventional sense, the key stories are instead displayed as "supporting content".
1256+
However, simply passing an empty string as the article headline still reserves space.
1257+
The storylines check enables us to avoid rendering that space at all.
1258+
*/}
1259+
{/* the div is needed to keep the headline and trail text justified at the start */}
12591260
{!(storylinesStyle && isFlexSplash) && (
12601261
<div
12611262
css={css`

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ type Props = {
3030
isTagPage: boolean;
3131
showClock?: boolean;
3232
colour?: string;
33-
// We use storylinesStyle to force the desired appearance of the CardAge in storylines sections on tag pages
3433
storylinesStyle?: boolean;
3534
};
3635

dotcom-rendering/src/components/FlexibleGeneral.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ const decideSplashCardProperties = (
209209
? 'horizontal'
210210
: 'vertical',
211211
liveUpdatesAlignment: 'vertical',
212-
trailTextSize: storylinesStyle ? 'large' : 'regular',
212+
trailTextSize: 'regular',
213213
subtitleSize: 'medium',
214214
};
215215
case 'megaboost':

dotcom-rendering/src/components/StorylinesSection.tsx

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { Hide } from '@guardian/source/react-components';
1010
import { submitComponentEvent } from '../client/ophan/ophan';
1111
import { type EditionId, isNetworkFront } from '../lib/edition';
1212
import { palette as schemePalette } from '../palette';
13-
import type { CollectionBranding } from '../types/branding';
1413
import type { DCRContainerLevel, DCRContainerPalette } from '../types/front';
1514
import { ContainerOverrides } from './ContainerOverrides';
1615
import { ContainerTitle } from './ContainerTitle';
@@ -31,8 +30,6 @@ type Props = {
3130
pageId?: string;
3231
/** Defaults to `true`. If we should render the top border */
3332
showTopBorder?: boolean;
34-
/** A React component can be passed to be inserted inside the left column */
35-
leftContent?: React.ReactNode;
3633
children?: React.ReactNode;
3734
/** The string used to set the `data-component` Ophan attribute */
3835
ophanComponentName?: string;
@@ -58,7 +55,6 @@ type Props = {
5855
showDateHeader?: boolean;
5956
/** Used in partnership with `showDateHeader` to localise the date string */
6057
editionId: EditionId;
61-
collectionBranding?: CollectionBranding;
6258
isTagPage?: boolean;
6359
hasNavigationButtons?: boolean;
6460
likeHandler?: () => void;
@@ -409,12 +405,11 @@ const carouselNavigationPlaceholder = css`
409405
}
410406
`;
411407

412-
/// todo: finish mobile and tablet representation
413-
414408
/**
415409
* # Front Container
416410
*
417-
* A container for fronts, which generally contains sets of cards.
411+
* A container for the storylines content on tag pages,
412+
* which contains sets of cards.
418413
*
419414
* Provides borders, spacing, colours, a title and features specific to fronts
420415
* such as show/hide toggle button. Content slotted as `children` is placed
@@ -433,33 +428,33 @@ const carouselNavigationPlaceholder = css`
433428
* │▒▒▒▒▒▒▒│
434429
* │▒▒▒▒▒▒▒│
435430
* ├───────┤
436-
* │Show │
437-
* |More │
431+
* │AI Note│
432+
* │Context│
433+
* │Footer │
438434
* └───────┘
439435
*
440436
* from `tablet` (740) to `desktop` (980)
441437
*
442438
* 1 2 3 4 5 6 7 8 9 a b c (12)
443439
* ┌───────────────────────┐
444440
* │Title │
445-
* │Date │
446441
* ├───────────────────────┤
447442
* │▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
448443
* │▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
449444
* ├───────────────────────┤
450-
* │Show More
445+
* │AI note,context,footer
451446
* └───────────────────────┘
452447
*
453448
* on `leftCol` (1140) if component is toggleable
454449
*
455450
* 1 2 3 4 5 6 7 8 9 a b c d e (14)
456451
* ┌───┬───────────────────┬─┐
457452
* │Tit│ │X│
458-
* │AI├───────────────────┴─┤
453+
* │AI ├───────────────────┴─┤
459454
* ├───┤▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
460455
* │ │▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
461456
* │Foo│▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
462-
* │ter│▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
457+
* │ter│Content context info
463458
* ├───┼─────────────────────┤
464459
*
465460
* on `leftCol` (1140) if component is not toggleable
@@ -471,7 +466,7 @@ const carouselNavigationPlaceholder = css`
471466
* ├───┤▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
472467
* │ │▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
473468
* │Foo│▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
474-
* │ter │Content context line
469+
* │ter│Content context info
475470
* ├───┼──────────────────────┤
476471
*
477472
* on `wide` (1300)
@@ -484,15 +479,17 @@ const carouselNavigationPlaceholder = css`
484479
* ├─────-┤▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ │
485480
* │ │▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ │
486481
* │ │▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ │
487-
* │Footer│Content context line
482+
* │Footer│Content context info
488483
* ├────────────────────────────────┤
489484
*
490485
*/
491486

492-
/** This is largely a copy of front section (notably re the grid layout), but with some modifications:
493-
* Some text has been added below the title about AI use
494-
* 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
495-
* A portion of the props and logic in frontsection aren't relevant here
487+
/**
488+
* This is based on @see {FrontSection.tsx} but with some modifications:
489+
* - Some text has been added regarding the use of AI in this section
490+
* - 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
491+
* - Instead of treats, we have a footer with like/dislike buttons
492+
* - A portion of the props and logic in frontsection aren't relevant here
496493
*/
497494
export const StorylinesSection = ({
498495
title,
@@ -502,7 +499,6 @@ export const StorylinesSection = ({
502499
containerLevel,
503500
description,
504501
editionId,
505-
leftContent,
506502
ophanComponentLink,
507503
ophanComponentName,
508504
sectionId = '',
@@ -511,20 +507,20 @@ export const StorylinesSection = ({
511507
showTopBorder = true,
512508
toggleable = false,
513509
url,
514-
collectionBranding,
515510
isTagPage = false,
516511
hasNavigationButtons = false,
517512
dislikeHandler,
518513
likeHandler,
519514
}: Props) => {
520-
const id = sectionId || 'unknown-id'; //todo: figure out what this should be
515+
const id = sectionId || 'unknown-id'; //gltodo: figure out what this should be
521516
const isToggleable = toggleable && !!sectionId;
522517
const isBetaContainer = !!containerLevel;
523518

524519
const showSectionColours = isNetworkFront(pageId ?? '');
525520

526521
/**
527-
* id is being used to set the containerId in @see {ShowMore.importable.tsx}
522+
* In a front section, id is being used to set the containerId in @see {ShowMore.importable.tsx}
523+
* We don't use show more here, however as noted in the front section component:
528524
* this id pre-existed showMore so is probably also being used for something else.
529525
*/
530526
return (
@@ -616,10 +612,8 @@ export const StorylinesSection = ({
616612
</div>
617613
</>
618614
}
619-
collectionBranding={collectionBranding}
615+
collectionBranding={undefined}
620616
/>
621-
622-
{leftContent}
623617
</div>
624618

625619
{(isToggleable || hasNavigationButtons) && (

dotcom-rendering/src/components/SupportingKeyStoriesContent.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { CardAge } from './Card/components/CardAge';
77
import { CardHeadline } from './CardHeadline';
88
import { ContainerOverrides } from './ContainerOverrides';
99
import { FormatBoundary } from './FormatBoundary';
10-
import { Alignment } from './SupportingContent';
10+
import type { Alignment } from './SupportingContent';
1111

1212
type Props = {
1313
supportingContent: DCRSupportingContent[];
@@ -126,9 +126,6 @@ const backgroundFillDesktop = (isMedia: boolean) => css`
126126
: palette('--card-sublinks-background')};
127127
}
128128
`;
129-
4;
130-
//gltodo: remove horizontal alignment option?
131-
//what about on tablet?
132129

133130
/** In the storylines section on tag pages, the flex splash is used to display key stories.
134131
This is shown as a large image taken from the first article in the group, and the headlines of the first four key articles (include that of the first article).

dotcom-rendering/src/layouts/TagPageLayout.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,10 @@ export const TagPageLayout = ({ tagPage, NAV }: Props) => {
135135
)
136136
: undefined;
137137

138-
//gltodo: check the pagination if it works as expected on single container tag pages
139-
// also
138+
// We insert the storylines section after the first section or if there's only one section
140139
const insertStorylinesSection =
141140
tagPage.storylinesContent &&
142-
index == 1 &&
141+
(index === 1 || tagPage.groupedTrails.length === 1) &&
143142
(!tagPage.pagination ||
144143
tagPage.pagination.currentPage === 1);
145144

0 commit comments

Comments
 (0)