@@ -21,6 +21,7 @@ import type { ResponsiveFontSize } from './CardHeadline';
21
21
import type { Loading } from './CardPicture' ;
22
22
import { FeatureCard } from './FeatureCard' ;
23
23
import { FrontCard } from './FrontCard' ;
24
+ import { Hide } from './Hide' ;
24
25
import type { Alignment } from './SupportingContent' ;
25
26
26
27
type Props = {
@@ -32,6 +33,7 @@ type Props = {
32
33
aspectRatio : AspectRatio ;
33
34
containerLevel ?: DCRContainerLevel ;
34
35
collectionId : number ;
36
+ isInNoBoostsAbTestVariant ?: boolean ;
35
37
} ;
36
38
37
39
type RowLayout = 'oneCardHalfWidth' | 'oneCardFullWidth' | 'twoCard' ;
@@ -580,18 +582,27 @@ export const FlexibleGeneral = ({
580
582
aspectRatio,
581
583
containerLevel = 'Primary' ,
582
584
collectionId,
585
+ isInNoBoostsAbTestVariant,
583
586
} : Props ) => {
584
587
const splash = [ ...groupedTrails . splash ] . slice ( 0 , 1 ) . map ( ( snap ) => ( {
585
588
...snap ,
586
589
uniqueId : `collection-${ collectionId } -splash-0` ,
587
590
} ) ) ;
591
+
588
592
const cards = [ ...groupedTrails . standard ]
589
593
. slice ( 0 , 19 )
590
594
. map ( ( standard , i ) => ( {
591
595
...standard ,
592
596
uniqueId : `collection-${ collectionId } -standard-${ i } ` ,
593
597
} ) ) ;
598
+
599
+ const cardsInAbTest = cards . map ( ( card ) => ( {
600
+ ...card ,
601
+ boostLevel : isInNoBoostsAbTestVariant ? 'default' : card . boostLevel ,
602
+ } ) ) ;
603
+
594
604
const groupedCards = decideCardPositions ( cards ) ;
605
+ const groupedCardsInAbTest = decideCardPositions ( cardsInAbTest ) ;
595
606
596
607
return (
597
608
< >
@@ -609,45 +620,88 @@ export const FlexibleGeneral = ({
609
620
/>
610
621
) }
611
622
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 >
651
705
</ >
652
706
) ;
653
707
} ;
0 commit comments