@@ -21,6 +21,7 @@ import type { ResponsiveFontSize } from './CardHeadline';
2121import type { Loading } from './CardPicture' ;
2222import { FeatureCard } from './FeatureCard' ;
2323import { FrontCard } from './FrontCard' ;
24+ import { Hide } from './Hide' ;
2425import type { Alignment } from './SupportingContent' ;
2526
2627type Props = {
@@ -32,6 +33,7 @@ type Props = {
3233 aspectRatio : AspectRatio ;
3334 containerLevel ?: DCRContainerLevel ;
3435 collectionId : number ;
36+ isInNoBoostsAbTestVariant ?: boolean ;
3537} ;
3638
3739type RowLayout = 'oneCardHalfWidth' | 'oneCardFullWidth' | 'twoCard' ;
@@ -580,18 +582,27 @@ export const FlexibleGeneral = ({
580582 aspectRatio,
581583 containerLevel = 'Primary' ,
582584 collectionId,
585+ isInNoBoostsAbTestVariant,
583586} : Props ) => {
584587 const splash = [ ...groupedTrails . splash ] . slice ( 0 , 1 ) . map ( ( snap ) => ( {
585588 ...snap ,
586589 uniqueId : `collection-${ collectionId } -splash-0` ,
587590 } ) ) ;
591+
588592 const cards = [ ...groupedTrails . standard ]
589593 . slice ( 0 , 19 )
590594 . map ( ( standard , i ) => ( {
591595 ...standard ,
592596 uniqueId : `collection-${ collectionId } -standard-${ i } ` ,
593597 } ) ) ;
598+
599+ const cardsInAbTest = cards . map ( ( card ) => ( {
600+ ...card ,
601+ boostLevel : isInNoBoostsAbTestVariant ? 'default' : card . boostLevel ,
602+ } ) ) ;
603+
594604 const groupedCards = decideCardPositions ( cards ) ;
605+ const groupedCardsInAbTest = decideCardPositions ( cardsInAbTest ) ;
595606
596607 return (
597608 < >
@@ -609,45 +620,88 @@ export const FlexibleGeneral = ({
609620 />
610621 ) }
611622
612- { groupedCards . map ( ( row , i ) => {
613- switch ( row . layout ) {
614- case 'oneCardFullWidth' :
615- return (
616- < FullWidthCardLayout
617- key = { row . cards [ 0 ] ?. uniqueId }
618- cards = { row . cards }
619- containerPalette = { containerPalette }
620- showAge = { showAge }
621- absoluteServerTimes = { absoluteServerTimes }
622- imageLoading = { imageLoading }
623- aspectRatio = { aspectRatio }
624- isFirstRow = { ! splash . length && i === 0 }
625- isLastRow = { i === groupedCards . length - 1 }
626- containerLevel = { containerLevel }
627- collectionId = { collectionId }
628- />
629- ) ;
630-
631- case 'oneCardHalfWidth' :
632- case 'twoCard' :
633- default :
634- return (
635- < HalfWidthCardLayout
636- key = { row . cards [ 0 ] ?. uniqueId }
637- cards = { row . cards }
638- containerPalette = { containerPalette }
639- showAge = { showAge }
640- absoluteServerTimes = { absoluteServerTimes }
641- imageLoading = { imageLoading }
642- isFirstRow = { ! splash . length && i === 0 }
643- isFirstStandardRow = { i === 0 }
644- aspectRatio = { aspectRatio }
645- isLastRow = { i === groupedCards . length - 1 }
646- containerLevel = { containerLevel }
647- />
648- ) ;
649- }
650- } ) }
623+ < Hide when = "above" breakpoint = "tablet" >
624+ { groupedCardsInAbTest . map ( ( row , i ) => {
625+ switch ( row . layout ) {
626+ case 'oneCardFullWidth' :
627+ return (
628+ < FullWidthCardLayout
629+ key = { row . cards [ 0 ] ?. uniqueId }
630+ cards = { row . cards }
631+ containerPalette = { containerPalette }
632+ showAge = { showAge }
633+ absoluteServerTimes = { absoluteServerTimes }
634+ imageLoading = { imageLoading }
635+ aspectRatio = { aspectRatio }
636+ isFirstRow = { ! splash . length && i === 0 }
637+ isLastRow = { i === groupedCards . length - 1 }
638+ containerLevel = { containerLevel }
639+ collectionId = { collectionId }
640+ />
641+ ) ;
642+
643+ case 'oneCardHalfWidth' :
644+ case 'twoCard' :
645+ default :
646+ return (
647+ < HalfWidthCardLayout
648+ key = { row . cards [ 0 ] ?. uniqueId }
649+ cards = { row . cards }
650+ containerPalette = { containerPalette }
651+ showAge = { showAge }
652+ absoluteServerTimes = { absoluteServerTimes }
653+ imageLoading = { imageLoading }
654+ isFirstRow = { ! splash . length && i === 0 }
655+ isFirstStandardRow = { i === 0 }
656+ aspectRatio = { aspectRatio }
657+ isLastRow = { i === groupedCards . length - 1 }
658+ containerLevel = { containerLevel }
659+ />
660+ ) ;
661+ }
662+ } ) }
663+ </ Hide >
664+ < Hide when = "below" breakpoint = "tablet" >
665+ { groupedCards . map ( ( row , i ) => {
666+ switch ( row . layout ) {
667+ case 'oneCardFullWidth' :
668+ return (
669+ < FullWidthCardLayout
670+ key = { row . cards [ 0 ] ?. uniqueId }
671+ cards = { row . cards }
672+ containerPalette = { containerPalette }
673+ showAge = { showAge }
674+ absoluteServerTimes = { absoluteServerTimes }
675+ imageLoading = { imageLoading }
676+ aspectRatio = { aspectRatio }
677+ isFirstRow = { ! splash . length && i === 0 }
678+ isLastRow = { i === groupedCards . length - 1 }
679+ containerLevel = { containerLevel }
680+ collectionId = { collectionId }
681+ />
682+ ) ;
683+
684+ case 'oneCardHalfWidth' :
685+ case 'twoCard' :
686+ default :
687+ return (
688+ < HalfWidthCardLayout
689+ key = { row . cards [ 0 ] ?. uniqueId }
690+ cards = { row . cards }
691+ containerPalette = { containerPalette }
692+ showAge = { showAge }
693+ absoluteServerTimes = { absoluteServerTimes }
694+ imageLoading = { imageLoading }
695+ isFirstRow = { ! splash . length && i === 0 }
696+ isFirstStandardRow = { i === 0 }
697+ aspectRatio = { aspectRatio }
698+ isLastRow = { i === groupedCards . length - 1 }
699+ containerLevel = { containerLevel }
700+ />
701+ ) ;
702+ }
703+ } ) }
704+ </ Hide >
651705 </ >
652706 ) ;
653707} ;
0 commit comments