11import { css } from '@emotion/react' ;
22import { isUndefined } from '@guardian/libs' ;
33import { between , from , space , until } from '@guardian/source/foundations' ;
4- import { Hide , Link , SvgCamera } from '@guardian/source/react-components' ;
4+ import { Hide , Link } from '@guardian/source/react-components' ;
55import {
66 ArticleDesign ,
77 type ArticleFormat ,
@@ -337,14 +337,6 @@ const decideSublinkPosition = (
337337 return alignment === 'vertical' ? 'inner' : 'outer' ;
338338} ;
339339
340- const liveBulletStyles = css `
341- width : 9px ;
342- height : 9px ;
343- border-radius : 50% ;
344- background-color : ${ palette ( '--pill-bullet' ) } ;
345- margin-right : ${ space [ 1 ] } px;
346- ` ;
347-
348340export const Card = ( {
349341 linkTo,
350342 format,
@@ -489,85 +481,6 @@ export const Card = ({
489481 </ Link >
490482 ) ;
491483
492- const MediaOrNewsletterPill = ( ) => (
493- < div
494- css = { css `
495- margin-top : auto;
496- display : flex;
497- ${ isStorylines &&
498- `
499- flex-direction: column;
500- gap: ${ space [ 1 ] } px;
501- align-items: flex-start;
502- ` }
503- ` }
504- >
505- { /* Usually, we either display the pill or the footer,
506- but if the card appears in the storylines section on tag pages
507- then we do want to display the date on these cards as well as the media pill.
508- */ }
509- { isStorylines && (
510- < CardFooter
511- format = { format }
512- age = { decideAge ( ) }
513- commentCount = { < CommentCount /> }
514- cardBranding = {
515- isOnwardContent ? < LabsBranding /> : undefined
516- }
517- showLivePlayable = { showLivePlayable }
518- />
519- ) }
520-
521- { mainMedia ?. type === 'YoutubeVideo' && isVideoArticle && (
522- < >
523- { mainMedia . isLive ? (
524- < Pill
525- content = "Live"
526- icon = { < div css = { liveBulletStyles } /> }
527- />
528- ) : (
529- < Pill
530- content = { secondsToDuration ( mainMedia . duration ) }
531- icon = { < SvgMediaControlsPlay width = { 18 } /> }
532- prefix = "Video"
533- />
534- ) }
535- </ >
536- ) }
537- { mainMedia ?. type === 'Audio' && (
538- < Pill
539- content = { mainMedia . duration }
540- icon = { < SvgMediaControlsPlay width = { 18 } /> }
541- prefix = "Podcast"
542- />
543- ) }
544- { mainMedia ?. type === 'Gallery' && (
545- < Pill
546- content = { mainMedia . count }
547- icon = { < SvgCamera /> }
548- prefix = "Gallery"
549- />
550- ) }
551- { mainMedia ?. type === 'SelfHostedVideo' &&
552- ( format . design === ArticleDesign . Video ? (
553- < Pill
554- content = ""
555- icon = { < SvgMediaControlsPlay width = { 18 } /> }
556- prefix = "Video"
557- />
558- ) : format . design === ArticleDesign . Audio ? (
559- < Pill
560- content = ""
561- icon = { < SvgMediaControlsPlay width = { 18 } /> }
562- prefix = "Podcast"
563- />
564- ) : format . design === ArticleDesign . Gallery ? (
565- < Pill content = "" icon = { < SvgCamera /> } prefix = "Gallery" />
566- ) : null ) }
567- { isNewsletter && < Pill content = "Newsletter" /> }
568- </ div >
569- ) ;
570-
571484 if ( snapData ?. embedHtml ) {
572485 return (
573486 < SnapCssSandbox snapData = { snapData } >
@@ -589,13 +502,11 @@ export const Card = ({
589502 isOnwardContent && onwardsSource === 'more-galleries' ;
590503
591504 /**
592- - * Media cards have contrasting background colours. We add additional
593- * padding to these cards to keep the text readable.
594- - */
505+ * Media cards have contrasting background colours. We add additional
506+ * padding to these cards to keep the text readable.
507+ */
595508 const isMediaCardOrNewsletter = isMediaCard ( format ) || isNewsletter ;
596509
597- const showPill = isMediaCardOrNewsletter && ! isGallerySecondaryOnward ;
598-
599510 const media = getMedia ( {
600511 imageUrl : image ?. src ,
601512 imageAltText : image ?. altText ,
@@ -1300,32 +1211,23 @@ export const Card = ({
13001211 />
13011212 ) }
13021213
1303- { ! isOpinionCardWithAvatar && (
1304- < >
1305- { showPill ? (
1306- < >
1307- { ! ! branding &&
1308- format . theme ===
1309- ArticleSpecial . Labs &&
1310- isOnwardContent && (
1311- < LabsBranding />
1312- ) }
1313- < MediaOrNewsletterPill />
1314- </ >
1315- ) : (
1316- < CardFooter
1317- format = { format }
1318- age = { decideAge ( ) }
1319- commentCount = { < CommentCount /> }
1320- cardBranding = {
1321- isOnwardContent ? (
1322- < LabsBranding />
1323- ) : undefined
1324- }
1325- showLivePlayable = { showLivePlayable }
1326- />
1327- ) }
1328- </ >
1214+ { ! isOpinionCardWithAvatar && ! showLivePlayable && (
1215+ < CardFooter
1216+ format = { format }
1217+ age = { decideAge ( ) }
1218+ commentCount = { < CommentCount /> }
1219+ cardBranding = {
1220+ isOnwardContent ? (
1221+ < LabsBranding />
1222+ ) : undefined
1223+ }
1224+ mainMedia = {
1225+ ! isGallerySecondaryOnward
1226+ ? mainMedia
1227+ : undefined
1228+ }
1229+ isNewsletter = { isNewsletter }
1230+ />
13291231 ) }
13301232 { showLivePlayable &&
13311233 liveUpdatesPosition === 'inner' && (
@@ -1410,12 +1312,11 @@ export const Card = ({
14101312
14111313 { decideOuterSublinks ( ) }
14121314
1413- { isOpinionCardWithAvatar && (
1315+ { isOpinionCardWithAvatar && ! showLivePlayable && (
14141316 < CardFooter
14151317 format = { format }
14161318 age = { decideAge ( ) }
14171319 commentCount = { < CommentCount /> }
1418- showLivePlayable = { showLivePlayable }
14191320 shouldReserveSpace = { {
14201321 mobile : avatarPosition . mobile === 'bottom' ,
14211322 desktop : avatarPosition . desktop === 'bottom' ,
0 commit comments