Skip to content

Commit 7d0e830

Browse files
committed
Wrap card is <Hide> rather than container
1 parent 301bcdf commit 7d0e830

File tree

1 file changed

+80
-89
lines changed

1 file changed

+80
-89
lines changed

dotcom-rendering/src/components/FlexibleGeneral.tsx

Lines changed: 80 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -596,13 +596,7 @@ export const FlexibleGeneral = ({
596596
uniqueId: `collection-${collectionId}-standard-${i}`,
597597
}));
598598

599-
const cardsInAbTest = cards.map((card) => ({
600-
...card,
601-
boostLevel: isInNoBoostsAbTestVariant ? 'default' : card.boostLevel,
602-
}));
603-
604599
const groupedCards = decideCardPositions(cards);
605-
const groupedCardsInAbTest = decideCardPositions(cardsInAbTest);
606600

607601
return (
608602
<>
@@ -619,89 +613,86 @@ export const FlexibleGeneral = ({
619613
collectionId={collectionId}
620614
/>
621615
)}
622-
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>
616+
{groupedCards.map((row, i) => {
617+
switch (row.layout) {
618+
case 'oneCardFullWidth':
619+
return isInNoBoostsAbTestVariant ? (
620+
<>
621+
<Hide when="above" breakpoint="tablet">
622+
<HalfWidthCardLayout
623+
key={row.cards[0]?.uniqueId}
624+
cards={row.cards}
625+
containerPalette={containerPalette}
626+
showAge={showAge}
627+
absoluteServerTimes={
628+
absoluteServerTimes
629+
}
630+
imageLoading={imageLoading}
631+
isFirstRow={!splash.length && i === 0}
632+
isFirstStandardRow={i === 0}
633+
aspectRatio={aspectRatio}
634+
isLastRow={
635+
i === groupedCards.length - 1
636+
}
637+
containerLevel={containerLevel}
638+
/>
639+
</Hide>
640+
<Hide when="below" breakpoint="tablet">
641+
<FullWidthCardLayout
642+
key={row.cards[0]?.uniqueId}
643+
cards={row.cards}
644+
containerPalette={containerPalette}
645+
showAge={showAge}
646+
absoluteServerTimes={
647+
absoluteServerTimes
648+
}
649+
imageLoading={imageLoading}
650+
aspectRatio={aspectRatio}
651+
isFirstRow={!splash.length && i === 0}
652+
isLastRow={
653+
i === groupedCards.length - 1
654+
}
655+
containerLevel={containerLevel}
656+
collectionId={collectionId}
657+
/>
658+
</Hide>
659+
</>
660+
) : (
661+
<FullWidthCardLayout
662+
key={row.cards[0]?.uniqueId}
663+
cards={row.cards}
664+
containerPalette={containerPalette}
665+
showAge={showAge}
666+
absoluteServerTimes={absoluteServerTimes}
667+
imageLoading={imageLoading}
668+
aspectRatio={aspectRatio}
669+
isFirstRow={!splash.length && i === 0}
670+
isLastRow={i === groupedCards.length - 1}
671+
containerLevel={containerLevel}
672+
collectionId={collectionId}
673+
/>
674+
);
675+
676+
case 'oneCardHalfWidth':
677+
case 'twoCard':
678+
default:
679+
return (
680+
<HalfWidthCardLayout
681+
key={row.cards[0]?.uniqueId}
682+
cards={row.cards}
683+
containerPalette={containerPalette}
684+
showAge={showAge}
685+
absoluteServerTimes={absoluteServerTimes}
686+
imageLoading={imageLoading}
687+
isFirstRow={!splash.length && i === 0}
688+
isFirstStandardRow={i === 0}
689+
aspectRatio={aspectRatio}
690+
isLastRow={i === groupedCards.length - 1}
691+
containerLevel={containerLevel}
692+
/>
693+
);
694+
}
695+
})}
705696
</>
706697
);
707698
};

0 commit comments

Comments
 (0)