Skip to content

Commit 1d1d4b0

Browse files
committed
Add stories for containers with feature cards
1 parent a5e5f5d commit 1d1d4b0

File tree

5 files changed

+268
-5
lines changed

5 files changed

+268
-5
lines changed

dotcom-rendering/fixtures/manual/trails.ts

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,3 +560,215 @@ export const trails: [
560560
showMainVideo: true,
561561
},
562562
];
563+
564+
export const audioTrails: [DCRFrontCard, DCRFrontCard] = [
565+
{
566+
format: { design: 3, display: 0, theme: 0 },
567+
url: '/news/audio/2025/feb/19/from-the-archive-was-it-inevitable-a-short-history-of-russias-war-on-ukraine-podcast',
568+
headline:
569+
'Was it inevitable? A short history of Russia’s war on Ukraine',
570+
showQuotedHeadline: false,
571+
dataLinkName: 'media | group-0 | card-@1',
572+
discussionApiUrl: '',
573+
isExternalLink: false,
574+
showLivePlayable: false,
575+
trailText:
576+
'This week, from 2022: To understand the tragedy of this war, it is worth going back beyond the last few weeks and months, and even beyond Vladimir Putin. By Keith Gessen. Read by Andrew McGregor',
577+
webPublicationDate: '2025-02-19T05:00:25.000Z',
578+
kickerText: 'The Audio Long Read',
579+
mainMedia: {
580+
type: 'Audio',
581+
duration: '46:12',
582+
podcastImage: {
583+
src: 'https://uploads.guim.co.uk/2021/01/22/AudioLongReadJan2021.jpg',
584+
altText: 'The Audio Long Read',
585+
},
586+
},
587+
image: {
588+
src: 'https://media.guim.co.uk/3c630f4309d8063a5b849bdcd5e57665f837fe13/0_147_4405_2643/master/4405.jpg',
589+
altText:
590+
'A military facility destroyed by shelling near Kyiv, 1 March 2022. Photograph: Genya Savilov/AFP/Getty Images',
591+
},
592+
},
593+
{
594+
format: { design: 3, display: 0, theme: 2 },
595+
url: '/football/audio/2025/feb/19/celtic-bayern-munich-champions-league-chaos-football-weekly-podcast',
596+
headline: 'Celtic’s heartbreak and Champions League playoff chaos ',
597+
showQuotedHeadline: false,
598+
dataLinkName: 'media | group-0 | card-@1',
599+
discussionApiUrl: '',
600+
isExternalLink: false,
601+
showLivePlayable: false,
602+
trailText:
603+
'Max Rushden is joined by Barry Glendenning, Paul Watson, Nick Ames, Ewan Murray and Jim Burke to discuss the latest Champions League playoff games, Everton’s new ground and much more',
604+
webPublicationDate: '2025-02-19T14:11:54.000Z',
605+
kickerText: 'Football Weekly',
606+
mainMedia: {
607+
type: 'Audio',
608+
duration: '54:52',
609+
podcastImage: {
610+
src: 'https://uploads.guim.co.uk/2024/08/01/FootballWeekly_FINAL_3000_(1).jpg',
611+
altText: 'Football Weekly',
612+
},
613+
},
614+
image: {
615+
src: 'https://media.guim.co.uk/01ded462d3dd730467bdfd652decda4117d925da/0_0_2074_1244/master/2074.jpg',
616+
altText:
617+
"TOPSHOT-FBL-EUR-C1-MILAN-FEYENOORD<br>TOPSHOT - Polish referee Szymon Marciniak gives a red card to AC Milan's French defender #19 Theo Hernandez (R) during the UEFA Champions League knockout round play-off second leg football match between AC Milan and Feyenoord at San Siro stadium in Milan, on February 18, 2025. (Photo by Piero CRUCIATTI / AFP) (Photo by PIERO CRUCIATTI/AFP via Getty Images)",
618+
},
619+
},
620+
];
621+
622+
export const galleryTrails: [DCRFrontCard, DCRFrontCard] = [
623+
{
624+
format: { design: 2, display: 1, theme: 4 },
625+
dataLinkName: 'media | group-0 | card-@5',
626+
url: '/fashion/gallery/2025/feb/01/we-love-fashion-fixes-for-the-week-ahead-in-pictures',
627+
headline: 'On trend hoods and eye-catching tights',
628+
trailText:
629+
'On trend hoods, eye-catching tights and David Beckham models for Boss',
630+
webPublicationDate: '2025-02-01T23:45:55.000Z',
631+
kickerText: 'Fashion fixes',
632+
supportingContent: [],
633+
discussionApiUrl: 'https://discussion.theguardian.com/discussion-api',
634+
mainMedia: { type: 'Gallery', count: '6' },
635+
image: {
636+
src: 'https://media.guim.co.uk/003d9dbe35c7a64a1e109a38450f3704deaeac24/2_240_3598_2159/master/3598.jpg',
637+
altText:
638+
'Barbour X Erdem Dhalia Wax Jacket RRP £519.00 Available at Barbour.com (1)',
639+
},
640+
showQuotedHeadline: false,
641+
isExternalLink: false,
642+
showLivePlayable: false,
643+
},
644+
{
645+
format: { design: 2, display: 1, theme: 0 },
646+
dataLinkName: 'media | group-0 | card-@2',
647+
url: '/global-development/gallery/2025/feb/07/goma-congolese-photographer-arlette-bashizi-home-city-rwandan-backed-m23-rebels',
648+
headline: 'The fall of Goma: 16 days of chaos and fear – in pictures',
649+
trailText:
650+
'Congolese photographer Arlette Bashizi documented for Reuters the lead-up to and aftermath of the seizure of her home city by Rwandan-backed M23 rebels',
651+
webPublicationDate: '2025-02-07T05:00:36.000Z',
652+
kickerText: 'Democratic Republic of the Congo',
653+
discussionApiUrl: 'https://discussion.theguardian.com/discussion-api',
654+
mainMedia: { type: 'Gallery', count: '27' },
655+
showMainVideo: false,
656+
image: {
657+
src: 'https://media.guim.co.uk/69ac2383ea611126b54373865dac3e7e77981d7e/0_39_5500_3302/master/5500.jpg',
658+
altText: 'A group of people in the street, some looking worried',
659+
},
660+
showQuotedHeadline: false,
661+
isExternalLink: false,
662+
showLivePlayable: false,
663+
},
664+
];
665+
666+
export const videoTrails: [DCRFrontCard, DCRFrontCard] = [
667+
{
668+
format: { design: 4, display: 0, theme: 2 },
669+
dataLinkName: 'media | group-0 | card-@3',
670+
url: '/football/video/2024/dec/16/rashford-and-garnacho-omission-from-team-to-push-them-harder-says-amorim-video',
671+
headline:
672+
"Rashford and Garnacho omission from team to 'push them harder' says Amorim – video ",
673+
trailText:
674+
"Amorim said the team proved by the victory against City that they 'can leave anyone outside the squad and manage to win'",
675+
webPublicationDate: '2024-12-16T15:21:02.000Z',
676+
discussionApiUrl:
677+
'https://discussion.code.dev-theguardian.com/discussion-api',
678+
mainMedia: {
679+
type: 'Video',
680+
id: 'fa2ee832-c5e7-4305-8387-f0277d2d9e27',
681+
videoId: '9kIN--VV2LQ',
682+
duration: 117,
683+
title: "Rashford and Garnacho omission from team to 'push them harder' says Amorim – video ",
684+
width: 500,
685+
height: 300,
686+
origin: 'SNTV',
687+
expired: false,
688+
images: [
689+
{
690+
url: 'https://media.guim.co.uk/0cab2d745b3423b0fac318c9ee09b79678f568f8/0_56_3000_1688/2000.jpg',
691+
width: 2000,
692+
},
693+
{
694+
url: 'https://media.guim.co.uk/0cab2d745b3423b0fac318c9ee09b79678f568f8/0_56_3000_1688/1000.jpg',
695+
width: 1000,
696+
},
697+
{
698+
url: 'https://media.guim.co.uk/0cab2d745b3423b0fac318c9ee09b79678f568f8/0_56_3000_1688/500.jpg',
699+
width: 500,
700+
},
701+
{
702+
url: 'https://media.guim.co.uk/0cab2d745b3423b0fac318c9ee09b79678f568f8/0_56_3000_1688/140.jpg',
703+
width: 140,
704+
},
705+
{
706+
url: 'https://media.guim.co.uk/0cab2d745b3423b0fac318c9ee09b79678f568f8/0_56_3000_1688/3000.jpg',
707+
width: 3000,
708+
},
709+
],
710+
},
711+
showMainVideo: true,
712+
image: {
713+
src: 'https://media.guim.co.uk/0cab2d745b3423b0fac318c9ee09b79678f568f8/0_47_3000_1800/master/3000.jpg',
714+
altText:
715+
"Amorim said the team proved by the victory against City that they 'can leave anyone outside the squad and manage to win'",
716+
},
717+
showQuotedHeadline: false,
718+
isExternalLink: false,
719+
showLivePlayable: false,
720+
},
721+
{
722+
format: { design: 0, display: 0, theme: 0 },
723+
dataLinkName: 'news | group-0 | card-@2',
724+
url: '/uk-news/2025/jan/22/prince-harry-says-sun-publisher-made-historic-admission-as-he-settles-case',
725+
headline:
726+
'Prince Harry says Sun publisher made ‘historic admission’ as he settles case',
727+
trailText:
728+
'News Group Newspapers offered Harry ‘full and unequivocal apology’ for ‘serious intrusion’ by the paper',
729+
webPublicationDate: '2025-01-22T18:51:14.000Z',
730+
discussionApiUrl:
731+
'https://discussion.code.dev-theguardian.com/discussion-api',
732+
mainMedia: {
733+
type: 'Video',
734+
id: '03ac0c90-3a66-448c-8562-b66a9ca9360e',
735+
videoId: '_2wsSKq6yAk',
736+
duration: 71,
737+
title: "Prince Harry's lawyer says settlement is 'monumental victory' – video ",
738+
width: 500,
739+
height: 300,
740+
origin: 'Reuters',
741+
expired: false,
742+
images: [
743+
{
744+
url: 'https://media.guim.co.uk/908aa315f66a09bc6ea607b6049cd72decd2dfa6/0_0_5358_3014/2000.jpg',
745+
width: 2000,
746+
},
747+
{
748+
url: 'https://media.guim.co.uk/908aa315f66a09bc6ea607b6049cd72decd2dfa6/0_0_5358_3014/1000.jpg',
749+
width: 1000,
750+
},
751+
{
752+
url: 'https://media.guim.co.uk/908aa315f66a09bc6ea607b6049cd72decd2dfa6/0_0_5358_3014/500.jpg',
753+
width: 500,
754+
},
755+
{
756+
url: 'https://media.guim.co.uk/908aa315f66a09bc6ea607b6049cd72decd2dfa6/0_0_5358_3014/140.jpg',
757+
width: 140,
758+
},
759+
{
760+
url: 'https://media.guim.co.uk/908aa315f66a09bc6ea607b6049cd72decd2dfa6/0_0_5358_3014/5358.jpg',
761+
width: 5358,
762+
},
763+
],
764+
},
765+
showMainVideo: true,
766+
image: {
767+
src: 'https://media.guim.co.uk/4612af5f4667888fa697139cf570b6373d93a710/2446_345_3218_1931/master/3218.jpg',
768+
altText: 'Prince Harry leaves the high court in June 2023',
769+
},
770+
showQuotedHeadline: false,
771+
isExternalLink: false,
772+
showLivePlayable: false,
773+
},
774+
];

dotcom-rendering/src/components/ScrollableFeature.stories.tsx

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import { breakpoints } from '@guardian/source/foundations';
22
import type { Meta, StoryObj } from '@storybook/react';
33
import { discussionApiUrl } from '../../fixtures/manual/discussionApiUrl';
4+
import {
5+
audioTrails,
6+
galleryTrails,
7+
videoTrails,
8+
} from '../../fixtures/manual/trails';
49
import { ArticleDesign, ArticleDisplay, Pillar } from '../lib/articleFormat';
510
import type { DCRContainerPalette, DCRFrontCard } from '../types/front';
611
import { FrontSection } from './FrontSection';
@@ -53,8 +58,8 @@ const trails = new Array(6)
5358
}));
5459

5560
const meta = {
56-
title: 'Components/ScrollableFeature',
5761
component: ScrollableFeature,
62+
title: 'Components/ScrollableFeature',
5863
parameters: {
5964
chromatic: {
6065
viewports: [
@@ -70,6 +75,7 @@ const meta = {
7075
absoluteServerTimes: true,
7176
imageLoading: 'eager',
7277
aspectRatio: '4:5',
78+
collectionId: 1,
7379
},
7480
render: (args) => (
7581
<FrontSection
@@ -85,10 +91,22 @@ const meta = {
8591

8692
export default meta;
8793

88-
type Story = StoryObj<typeof ScrollableFeature>;
94+
type Story = StoryObj<typeof meta>;
8995

9096
export const Default = {};
9197

98+
export const Media = {
99+
args: {
100+
trails: [galleryTrails[0], galleryTrails[1], audioTrails[0]],
101+
},
102+
} satisfies Story;
103+
104+
export const MoreMedia = {
105+
args: {
106+
trails: [audioTrails[1], videoTrails[0], videoTrails[1]],
107+
},
108+
} satisfies Story;
109+
92110
export const WithPrimaryContainer = {
93111
render: (args) => (
94112
<FrontSection

dotcom-rendering/src/components/StaticFeatureTwo.stories.tsx

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import { breakpoints } from '@guardian/source/foundations';
22
import type { Meta, StoryObj } from '@storybook/react';
33
import { discussionApiUrl } from '../../fixtures/manual/discussionApiUrl';
4-
import { trails } from '../../fixtures/manual/trails';
4+
import {
5+
audioTrails,
6+
galleryTrails,
7+
trails,
8+
videoTrails,
9+
} from '../../fixtures/manual/trails';
510
import type { DCRContainerPalette } from '../types/front';
611
import { FrontSection } from './FrontSection';
712
import { StaticFeatureTwo } from './StaticFeatureTwo';
@@ -59,6 +64,30 @@ const containerPalettes = [
5964
'MediaPalette' | 'PodcastPalette'
6065
>[];
6166

67+
const audioCards = audioTrails.slice(0, 2);
68+
export const Audio = {
69+
args: {
70+
...Default,
71+
trails: audioCards,
72+
},
73+
} satisfies Story;
74+
75+
const galleryCards = galleryTrails.slice(0, 2);
76+
export const Gallery = {
77+
args: {
78+
...Default,
79+
trails: galleryCards,
80+
},
81+
} satisfies Story;
82+
83+
const videoCards = videoTrails.slice(0, 2);
84+
export const Video = {
85+
args: {
86+
...Default,
87+
trails: videoCards,
88+
},
89+
} satisfies Story;
90+
6291
export const WithSpecialPaletteVariations = {
6392
parameters: {
6493
/** We only want one breakpoint snapshotted for special palette variations */

dotcom-rendering/src/components/StaticFeatureTwo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const StaticFeatureTwo = ({
4040
return (
4141
<LI
4242
stretch={false}
43-
percentage={'50%'}
43+
percentage="50%"
4444
key={card.url}
4545
padSides={true}
4646
showDivider={true}

dotcom-rendering/src/components/YoutubeAtom/YoutubeAtomFeatureCardOverlay.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,11 @@ export const YoutubeAtomFeatureCardOverlay = ({
221221
) : undefined
222222
}
223223
showLivePlayable={false}
224-
mainMedia={{ type: 'Video', duration: duration ?? 0 }}
224+
mainMedia={
225+
isVideoArticle
226+
? { type: 'Video', duration: duration ?? 0 }
227+
: undefined
228+
}
225229
/>
226230
</div>
227231
</button>

0 commit comments

Comments
 (0)