diff --git a/dotcom-rendering/src/components/Card/Card.tsx b/dotcom-rendering/src/components/Card/Card.tsx index 3cc1a741fc3..c85c10761d2 100644 --- a/dotcom-rendering/src/components/Card/Card.tsx +++ b/dotcom-rendering/src/components/Card/Card.tsx @@ -821,6 +821,7 @@ export const Card = ({ ? palette('--onward-content-top-border') : undefined } + isLoopAndInLoopClickTestVariant={isLoopAndInLoopClickTestVariant} > {media.type === 'slideshow' && ( css` :hover .media-overlay { width: 100%; height: 100%; @@ -59,7 +60,11 @@ const hoverStyles = css` */ :has( ul.sublinks:hover, - .video-container:not(.cinemagraph):hover, + .video-container:not( + ${isLoopAndInLoopClickTestVariant + ? `.cinemagraph, .loop` + : `.cinemagraph`} + ):hover, .slideshow-carousel-footer:hover, .branding-logo:hover ) { @@ -100,6 +105,7 @@ export const CardWrapper = ({ showTopBarMobile, containerPalette, topBarColour = palette('--card-border-top'), + isLoopAndInLoopClickTestVariant, }: Props) => { return ( @@ -107,7 +113,7 @@ export const CardWrapper = ({
{ const isHorizontalOnMobile = mediaPositionOnMobile === 'left' || mediaPositionOnMobile === 'right'; @@ -209,6 +215,7 @@ export const MediaWrapper = ({ css` /* position relative is required here to bound the image overlay */ position: relative; + img { width: 100%; display: block; @@ -232,7 +239,9 @@ export const MediaWrapper = ({ <> {children} {/* This overlay is styled when the CardLink is hovered */} - {(mediaType === 'picture' || mediaType === 'cinemagraph') && ( + {(mediaType === 'picture' || + mediaType === 'cinemagraph' || + isLoopAndInLoopClickTestVariant == true) && (
css` :hover .media-overlay { position: absolute; top: 0; @@ -91,6 +91,8 @@ const hoverStyles = css` width: 100%; height: 100%; background-color: ${palette('--card-background-hover')}; + + ${isLoopAndInLoopClickTestVariant && loopClickThroughOverlayStyles} } ${underlineOnHoverStyles} @@ -106,6 +108,12 @@ const hoverStyles = css` } `; +const loopClickThroughOverlayStyles = css` + z-index: ${getZIndex('mediaOverlay')}; + cursor: pointer; + pointer-events: none; +`; + const contentStyles = css` display: flex; flex-basis: 100%; @@ -507,9 +515,15 @@ export const FeatureCard = ({ const aspectRatioNumber = isImmersive ? 5 / 3 : 4 / 5; - /* The whole card is clickable on cinemagraphs and pictures */ + /** The whole card is clickable for: + * - cinemagraphs + * - pictures + * - loops in the loop click test variant group + * */ const allowLinkThroughOverlay = - media.style === 'cinemagraph' || media.type === 'picture'; + media.style === 'cinemagraph' || + media.type === 'picture' || + isLoopAndInLoopClickTestVariant; return ( @@ -517,7 +531,9 @@ export const FeatureCard = ({
{!isYoutubeVideo && !isSelfHostedVideoWithControls && ( @@ -692,7 +708,8 @@ export const FeatureCard = ({ )} {/* This overlay is styled when the CardLink is hovered */} - {!isSelfHostedVideoWithControls && ( + {(!isSelfHostedVideoWithControls || + isLoopAndInLoopClickTestVariant) && (
)}