File tree Expand file tree Collapse file tree 13 files changed +169
-83
lines changed
dotcom-rendering/src/components Expand file tree Collapse file tree 13 files changed +169
-83
lines changed Original file line number Diff line number Diff line change @@ -506,15 +506,14 @@ export const Card = ({
506
506
< >
507
507
{ mainMedia . duration === 0 ? (
508
508
< Pill
509
- content = { ' Live' }
509
+ content = " Live"
510
510
icon = { < div css = { liveBulletStyles } /> }
511
- iconSize = "small"
512
511
/>
513
512
) : (
514
513
< Pill
515
514
content = { secondsToDuration ( mainMedia . duration ) }
516
- icon = { < SvgMediaControlsPlay /> }
517
- iconSize = "small "
515
+ icon = { < SvgMediaControlsPlay width = { 18 } /> }
516
+ prefix = "Video "
518
517
/>
519
518
) }
520
519
</ >
@@ -523,16 +522,15 @@ export const Card = ({
523
522
{ mainMedia ?. type === 'Audio' && (
524
523
< Pill
525
524
content = { mainMedia . duration }
526
- icon = { < SvgMediaControlsPlay /> }
527
- iconSize = "small "
525
+ icon = { < SvgMediaControlsPlay width = { 18 } /> }
526
+ prefix = "Podcast "
528
527
/>
529
528
) }
530
529
{ mainMedia ?. type === 'Gallery' && (
531
530
< Pill
532
- prefix = "Gallery"
533
531
content = { mainMedia . count }
534
532
icon = { < SvgCamera /> }
535
- iconSide = "right "
533
+ prefix = "Gallery "
536
534
/>
537
535
) }
538
536
{ isNewsletter && < Pill content = "Newsletter" /> }
@@ -1021,8 +1019,11 @@ export const Card = ({
1021
1019
content = { secondsToDuration (
1022
1020
mainMedia . duration ,
1023
1021
) }
1024
- icon = { < SvgMediaControlsPlay /> }
1025
- iconSize = { 'small' }
1022
+ icon = {
1023
+ < SvgMediaControlsPlay
1024
+ width = { 18 }
1025
+ />
1026
+ }
1026
1027
/>
1027
1028
</ div >
1028
1029
) }
Original file line number Diff line number Diff line change @@ -5,17 +5,6 @@ import { palette } from '../../../palette';
5
5
import ClockIcon from '../../../static/icons/clock.svg' ;
6
6
import { DateTime } from '../../DateTime' ;
7
7
8
- type Props = {
9
- absoluteServerTimes : boolean ;
10
- webPublication : {
11
- date : string ;
12
- isWithinTwelveHours : boolean ;
13
- } ;
14
- showClock ?: boolean ;
15
- isTagPage : boolean ;
16
- colour ?: string ;
17
- } ;
18
-
19
8
const ageStyles = ( colour : string ) => {
20
9
return css `
21
10
${ textSansBold12 } ;
@@ -32,11 +21,22 @@ const ageStyles = (colour: string) => {
32
21
` ;
33
22
} ;
34
23
24
+ type Props = {
25
+ absoluteServerTimes : boolean ;
26
+ webPublication : {
27
+ date : string ;
28
+ isWithinTwelveHours : boolean ;
29
+ } ;
30
+ isTagPage : boolean ;
31
+ showClock ?: boolean ;
32
+ colour ?: string ;
33
+ } ;
34
+
35
35
export const CardAge = ( {
36
- webPublication,
37
- showClock,
38
36
absoluteServerTimes,
37
+ webPublication,
39
38
isTagPage,
39
+ showClock,
40
40
colour = palette ( '--card-footer-text' ) ,
41
41
} : Props ) => {
42
42
if ( timeAgo ( new Date ( webPublication . date ) . getTime ( ) ) === false ) {
Original file line number Diff line number Diff line change
1
+ import type { Meta , StoryObj } from '@storybook/react' ;
2
+ import {
3
+ ArticleDesign ,
4
+ ArticleDisplay ,
5
+ ArticleSpecial ,
6
+ Pillar ,
7
+ } from '../../../lib/articleFormat' ;
8
+ import { CardFooter as CardFooterComponent } from './CardFooter' ;
9
+
10
+ const meta = {
11
+ component : CardFooterComponent ,
12
+ title : 'Components/Card Footer' ,
13
+ } satisfies Meta < typeof CardFooterComponent > ;
14
+
15
+ export default meta ;
16
+
17
+ type Story = StoryObj < typeof meta > ;
18
+
19
+ export const WithAge = {
20
+ args : {
21
+ format : {
22
+ display : ArticleDisplay . Standard ,
23
+ design : ArticleDesign . Comment ,
24
+ theme : Pillar . Opinion ,
25
+ } ,
26
+ showLivePlayable : false ,
27
+ age : < p > 19h ago</ p > ,
28
+ } ,
29
+ } satisfies Story ;
30
+
31
+ export const WithGallery = {
32
+ ...WithAge ,
33
+ args : {
34
+ ...WithAge . args ,
35
+ mainMedia : {
36
+ type : 'Gallery' ,
37
+ count : '14' ,
38
+ } ,
39
+ } ,
40
+ } satisfies Story ;
41
+
42
+ export const WithAudio = {
43
+ ...WithAge ,
44
+ args : {
45
+ ...WithAge . args ,
46
+ mainMedia : {
47
+ type : 'Audio' ,
48
+ duration : '12:34' ,
49
+ } ,
50
+ } ,
51
+ } satisfies Story ;
52
+
53
+ export const WithVideo = {
54
+ ...WithAge ,
55
+ args : {
56
+ ...WithAge . args ,
57
+ mainMedia : {
58
+ type : 'Video' ,
59
+ duration : 972 ,
60
+ } ,
61
+ } ,
62
+ } satisfies Story ;
63
+
64
+ export const WithNewsletter = {
65
+ ...WithAge ,
66
+ args : {
67
+ ...WithAge . args ,
68
+ isNewsletter : true ,
69
+ } ,
70
+ } satisfies Story ;
71
+
72
+ export const WithBranding = {
73
+ ...WithAge ,
74
+ args : {
75
+ ...WithAge . args ,
76
+ format : {
77
+ ...WithAge . args . format ,
78
+ theme : ArticleSpecial . Labs ,
79
+ } ,
80
+ cardBranding : < p > Card branding</ p > ,
81
+ } ,
82
+ } satisfies Story ;
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ export const CardFooter = ({
75
75
commentCount,
76
76
cardBranding,
77
77
mainMedia,
78
- isNewsletter = false ,
78
+ isNewsletter,
79
79
shouldReserveSpace,
80
80
} : Props ) => {
81
81
if ( showLivePlayable ) return null ;
@@ -91,7 +91,8 @@ export const CardFooter = ({
91
91
content = {
92
92
< time > { secondsToDuration ( mainMedia . duration ) } </ time >
93
93
}
94
- icon = { < SvgMediaControlsPlay /> }
94
+ prefix = "Video"
95
+ icon = { < SvgMediaControlsPlay width = { 18 } /> }
95
96
/>
96
97
</ footer >
97
98
) ;
@@ -102,7 +103,8 @@ export const CardFooter = ({
102
103
< footer css = { contentStyles } >
103
104
< Pill
104
105
content = { < time > { mainMedia . duration } </ time > }
105
- icon = { < SvgMediaControlsPlay /> }
106
+ prefix = "Podcast"
107
+ icon = { < SvgMediaControlsPlay width = { 18 } /> }
106
108
/>
107
109
</ footer >
108
110
) ;
@@ -115,7 +117,6 @@ export const CardFooter = ({
115
117
content = { mainMedia . count }
116
118
prefix = "Gallery"
117
119
icon = { < SvgCamera /> }
118
- iconSide = "right"
119
120
/>
120
121
</ footer >
121
122
) ;
Original file line number Diff line number Diff line change @@ -54,6 +54,9 @@ const narrowStyles = css`
54
54
left : calc (50% - ${ narrowPlayIconWidth / 2 } px);
55
55
width : ${ narrowPlayIconWidth } px;
56
56
height : ${ narrowPlayIconWidth } px;
57
+ display : flex;
58
+ justify-content : center;
59
+ align-items : center;
57
60
background-color : ${ palette ( '--feature-card-play-icon-background' ) } ;
58
61
opacity : 0.7 ;
59
62
border-radius : 50% ;
@@ -92,7 +95,7 @@ export const PlayIcon = ({
92
95
] }
93
96
>
94
97
{ iconWidth === 'narrow' ? (
95
- < NarrowPlayIcon theme = { theme } />
98
+ < NarrowPlayIcon width = { 40 } theme = { theme } />
96
99
) : (
97
100
< WidePlayIcon theme = { theme } />
98
101
) }
Original file line number Diff line number Diff line change @@ -172,7 +172,7 @@ const decideSplashCardProperties = (
172
172
}
173
173
} ;
174
174
175
- export const SplashCardLayout = ( {
175
+ const SplashCardLayout = ( {
176
176
cards,
177
177
containerPalette,
178
178
showAge,
@@ -347,7 +347,7 @@ const decideCardProperties = (
347
347
}
348
348
} ;
349
349
350
- export const BoostedCardLayout = ( {
350
+ const BoostedCardLayout = ( {
351
351
cards,
352
352
containerPalette,
353
353
showAge,
@@ -431,7 +431,7 @@ export const BoostedCardLayout = ({
431
431
) ;
432
432
} ;
433
433
434
- export const StandardCardLayout = ( {
434
+ const StandardCardLayout = ( {
435
435
cards,
436
436
containerPalette,
437
437
showAge,
Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ export const WithPodcastSeriesImage: Story = {
116
116
} ,
117
117
mainMedia : {
118
118
type : 'Audio' ,
119
- duration : '31.76 ' ,
119
+ duration : '31:16 ' ,
120
120
podcastImage : {
121
121
src : 'https://uploads.guim.co.uk/2024/08/01/FootballWeekly_FINAL_3000_(1).jpg' ,
122
122
altText : 'Football Weekly' ,
Original file line number Diff line number Diff line change @@ -195,23 +195,22 @@ const MediaPill = ({ mainMedia }: { mainMedia: MainMedia }) => (
195
195
{ mainMedia . type === 'Video' && (
196
196
< Pill
197
197
content = { secondsToDuration ( mainMedia . duration ) }
198
- icon = { < SvgMediaControlsPlay /> }
199
- iconSize = "small"
198
+ prefix = "Video"
199
+ icon = { < SvgMediaControlsPlay width = { 18 } /> }
200
200
/>
201
201
) }
202
202
{ mainMedia . type === 'Audio' && (
203
203
< Pill
204
204
content = { mainMedia . duration }
205
- icon = { < SvgMediaControlsPlay /> }
206
- iconSize = "small"
205
+ prefix = "Podcast"
206
+ icon = { < SvgMediaControlsPlay width = { 18 } /> }
207
207
/>
208
208
) }
209
209
{ mainMedia . type === 'Gallery' && (
210
210
< Pill
211
- prefix = "Gallery"
212
211
content = { mainMedia . count }
212
+ prefix = "Gallery"
213
213
icon = { < SvgCamera /> }
214
- iconSide = "right"
215
214
/>
216
215
) }
217
216
</ div >
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ export const Default = {} satisfies Story;
20
20
export const WithVideoIcon = {
21
21
args : {
22
22
content : < time > 3:35</ time > ,
23
- icon : < SvgMediaControlsPlay /> ,
23
+ icon : < SvgMediaControlsPlay width = { 18 } /> ,
24
24
} ,
25
25
} satisfies Story ;
26
26
@@ -32,9 +32,17 @@ export const WithGalleryIcon = {
32
32
} ,
33
33
} satisfies Story ;
34
34
35
+ export const WithVideoIconAndPrefix = {
36
+ args : {
37
+ ...WithVideoIcon . args ,
38
+ prefix : 'Video' ,
39
+ } ,
40
+ } satisfies Story ;
41
+
35
42
export const WithGalleryIconAndPrefix = {
36
43
args : {
37
44
...WithGalleryIcon . args ,
38
45
prefix : 'Gallery' ,
46
+ iconSide : 'left' ,
39
47
} ,
40
48
} satisfies Story ;
You can’t perform that action at this time.
0 commit comments