Skip to content

Commit 880ef9b

Browse files
Merge pull request #12526 from bbc/WORLDSERVICE-280-storybook-example
WORLDSERVICE-280: Adds grid storybook example with media
2 parents 32043f6 + c80aadc commit 880ef9b

File tree

3 files changed

+146
-6
lines changed

3 files changed

+146
-6
lines changed

src/app/components/Curation/HierarchicalGrid/fixtures.js

Lines changed: 122 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const pidginPromos = [
1+
export const pidginPromos = [
22
{
33
title: 'Wetin happun for January 6 one year ago?',
44
type: 'article',
@@ -163,4 +163,124 @@ const pidginPromos = [
163163
},
164164
];
165165

166-
export default pidginPromos;
166+
export const pidginPromosWithMedia = [
167+
{
168+
type: 'article',
169+
isLive: false,
170+
title:
171+
'Fubara call for calm, NBA, PDP and odas tackle President Tinubu call for state of emergency for Rivers state',
172+
firstPublished: '2025-03-19T07:07:12.709Z',
173+
lastPublished: '2025-03-19T08:01:52.982Z',
174+
link: 'https://www.bbc.com/pidgin/articles/cjrypw53rg4o',
175+
imageUrl:
176+
'https://ichef.bbci.co.uk/ace/ws/{width}/cpsprodpb/12e2/live/17ba6a60-0490-11f0-aaf8-43ddac80c079.jpg.webp',
177+
description:
178+
'Reactions dey come in after Nigeria President Bola Tinubu declare a state of emergency for Rivers state and suspend di governor and oda elected officers.',
179+
imageAlt: 'Siminalayi Fubara',
180+
id: 'cjrypw53rg4o',
181+
},
182+
{
183+
type: 'article',
184+
isLive: false,
185+
title:
186+
'Who be Vice Admiral Ibok-Ete Ibas wey President Tinubu appoint Administrator of Rivers State?',
187+
firstPublished: '2025-03-18T19:11:23.902Z',
188+
lastPublished: '2025-03-18T19:11:23.902Z',
189+
link: 'https://www.bbc.com/pidgin/articles/c5y082yr1zeo',
190+
imageUrl:
191+
'https://ichef.bbci.co.uk/ace/ws/{width}/cpsprodpb/1ce9/live/fa4e6840-042c-11f0-94d4-6f954f5dcfa3.jpg.webp',
192+
description:
193+
'Ibok-Ete Ekwe Ibas join di Nigerian Defence Academy as a member of 26 Regular Course on 20 June 1979 and commissioned sub-lieutenant on 1 January 1983.',
194+
imageAlt: 'Ibok-Ete Ekwe Ibas',
195+
id: 'c5y082yr1zeo',
196+
},
197+
{
198+
type: 'article',
199+
isLive: false,
200+
title:
201+
'Wetin we know about di trans-Niger pipeline explosion for Rivers State',
202+
firstPublished: '2025-03-18T16:08:20.474Z',
203+
lastPublished: '2025-03-18T16:08:20.474Z',
204+
link: 'https://www.bbc.com/pidgin/articles/ckg8pknwn3lo',
205+
imageUrl:
206+
'https://ichef.bbci.co.uk/ace/ws/{width}/cpsprodpb/a763/live/d5e4f3d0-0403-11f0-94d4-6f954f5dcfa3.jpg.webp',
207+
description:
208+
'Di Trans Niger Pipeline na major pipeline wey dey transports crude for Niger delta.',
209+
imageAlt: 'Fire for Trans Niger Delta Pipeline',
210+
id: 'ckg8pknwn3lo',
211+
},
212+
{
213+
type: 'article',
214+
isLive: false,
215+
title: 'Nigeria House of Representatives pass Tinubu tax reform bills',
216+
firstPublished: '2025-03-18T12:47:54.448Z',
217+
lastPublished: '2025-03-18T12:47:54.448Z',
218+
link: 'https://www.bbc.com/pidgin/articles/c89y3d13w3qo',
219+
imageUrl:
220+
'https://ichef.bbci.co.uk/ace/ws/{width}/cpsprodpb/a32e/live/2671c100-03f7-11f0-9bb2-ab6d3a01d537.jpg.webp',
221+
description:
222+
'Members of di House of Representatives pass di bills afta dem read am for di third time at plenary, wey Speaker Abbas Tajudeen preside ova.',
223+
imageAlt: "Speaker of Nigeria's House of Representatives, Tajudeen Abbas\n",
224+
id: 'c89y3d13w3qo',
225+
},
226+
{
227+
type: 'article',
228+
isLive: false,
229+
title:
230+
'Over 400 pipo die after Israel strike Gaza overnight, Hamas ministry tok',
231+
firstPublished: '2025-03-18T11:12:53.693Z',
232+
lastPublished: '2025-03-18T11:12:53.693Z',
233+
link: 'https://www.bbc.com/pidgin/articles/cj92pv4z2kxo',
234+
imageUrl:
235+
'https://ichef.bbci.co.uk/ace/ws/{width}/cpsprodpb/ec9d/live/e30126b0-03db-11f0-a387-437e2fb661fc.png.webp',
236+
description:
237+
'Di Israeli military don attack different location for Gaza Strip, wey dem hit targets for Gaza City, Rafah and Khan Younis.',
238+
imageAlt: 'Di destruction from di airstrike',
239+
id: 'cj92pv4z2kxo',
240+
},
241+
{
242+
type: 'video',
243+
duration: 'PT1M29S',
244+
isLive: false,
245+
title: 'Nigeria senate chamber be like "cult" - Natasha Akpoti-Uduaghan',
246+
firstPublished: '2025-03-18T05:31:33.314Z',
247+
lastPublished: '2025-03-18T10:06:56.157Z',
248+
link: 'https://www.bbc.com/pidgin/articles/crmjpzy4vwlo',
249+
imageUrl:
250+
'https://ichef.bbci.co.uk/ace/ws/{width}/cpsprodpb/85ea/live/a4fc9b30-0384-11f0-9bb2-ab6d3a01d537.jpg.webp',
251+
description:
252+
'Nigerian Senator Natasha Akpoti-Uduaghan allege say she experience sexual harassment involving di President of di Nigerian Senate, allegation wey e deny.',
253+
imageAlt: 'Natasha Akpotu-Uduaghan',
254+
id: 'crmjpzy4vwlo',
255+
},
256+
{
257+
type: 'article',
258+
isLive: false,
259+
title:
260+
'All allegations Rivers House of Assembly members sama Govnor Fubara and im deputy',
261+
firstPublished: '2025-03-17T13:12:41.451Z',
262+
lastPublished: '2025-03-17T13:12:41.451Z',
263+
link: 'https://www.bbc.com/pidgin/articles/cm2j937261do',
264+
imageUrl:
265+
'https://ichef.bbci.co.uk/ace/ws/{width}/cpsprodpb/21ff/live/64d16ce0-0332-11f0-9d83-c7f80f10afdc.jpg.webp',
266+
description:
267+
'During plenary on Monday 17 March 2025, di Rivers lawmakers resolve to transmit di letter containing claims of gross misconduct to Govnor Siminalayi Fubara and di deputy govnor.',
268+
imageAlt: 'Martin Amaewhule and Governor Fubara',
269+
id: 'cm2j937261do',
270+
},
271+
{
272+
type: 'article',
273+
isLive: false,
274+
title:
275+
"Youth Corper wey call Tinubu 'terrible president' break any law? - Wetin NYSC Bye-Law tok",
276+
firstPublished: '2025-03-17T12:17:56.418Z',
277+
lastPublished: '2025-03-17T12:17:56.418Z',
278+
link: 'https://www.bbc.com/pidgin/articles/cgm1ekn44p1o',
279+
imageUrl:
280+
'https://ichef.bbci.co.uk/ace/ws/{width}/cpsprodpb/2630/live/bee8f3e0-0320-11f0-8c3d-b7dcc7510cb1.jpg.webp',
281+
description:
282+
'One video wey serving corp member post wey condemn Nigerian President Bola Tinubu administration don generate conversation for Nigeria.',
283+
imageAlt: 'NYSC corps members',
284+
id: 'cgm1ekn44p1o',
285+
},
286+
];

src/app/components/Curation/HierarchicalGrid/index.stories.tsx

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
import React from 'react';
22

33
import HierarchicalGrid from './index';
4-
import pidginPromos from './fixtures';
4+
import { pidginPromos, pidginPromosWithMedia } from './fixtures';
55

6-
const Component = ({ promoCount }: { promoCount: number }) => {
6+
const Component = ({
7+
promoCount,
8+
promosToRender,
9+
}: {
10+
promoCount: number;
11+
promosToRender: string;
12+
}) => {
13+
const fixtureData =
14+
promosToRender === 'default' ? pidginPromos : pidginPromosWithMedia;
715
return (
816
<HierarchicalGrid
917
headingLevel={2}
10-
summaries={pidginPromos.slice(0, promoCount)}
18+
summaries={fixtureData.slice(0, promoCount)}
1119
/>
1220
);
1321
};
@@ -17,6 +25,7 @@ export default {
1725
Component,
1826
args: {
1927
promoCount: 12,
28+
promosToRender: 'default',
2029
},
2130
argTypes: {
2231
promoCount: {
@@ -27,7 +36,18 @@ export default {
2736
step: 1,
2837
},
2938
},
39+
promosToRender: {
40+
control: {
41+
type: 'select',
42+
},
43+
options: ['default', 'withMedia'],
44+
},
3045
},
3146
};
3247

48+
export const WithMedia = {
49+
render: () => <Component promoCount={12} promosToRender="withMedia" />,
50+
tags: ['!dev'],
51+
};
52+
3353
export const Example = Component;

src/app/components/Curation/HierarchicalGrid/index.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import { suppressPropWarnings } from '../../../legacy/psammead/psammead-test-helpers/src';
33
import { render } from '../../react-testing-library-with-providers';
4-
import fixture from './fixtures';
4+
import { pidginPromos as fixture } from './fixtures';
55
import mediaFixture from './mediaFixtures';
66
import liveFixtures from './liveFixtures';
77
import HierarchicalGrid from '.';

0 commit comments

Comments
 (0)