diff --git a/dotcom-rendering/src/components/FeatureCard.tsx b/dotcom-rendering/src/components/FeatureCard.tsx index beab0442acb..1f3193c4843 100644 --- a/dotcom-rendering/src/components/FeatureCard.tsx +++ b/dotcom-rendering/src/components/FeatureCard.tsx @@ -164,38 +164,50 @@ const overlayMaskGradientStyles = (angle: string) => css` ); `; +const contentOverlayStyle = css` + position: absolute; + bottom: 0; + left: 0; + width: 100%; +`; + const overlayStyles = css` position: relative; display: flex; flex-direction: column; text-align: start; gap: ${space[1]}px; - padding: 64px ${space[2]}px ${space[2]}px; + padding: ${space[9]}px ${space[2]}px ${space[2]}px; + + /* + * Ensure the waveform is behind the other elements, e.g. headline, pill. + * Links define their own z-index. + */ + > :not(.waveform):not(a) { + z-index: 1; + } +`; + +const blurStyles = css` + position: absolute; + inset: 0; backdrop-filter: blur(12px) brightness(0.5); @supports not (backdrop-filter: blur(12px)) { background-color: ${transparentColour(sourcePalette.neutral[10], 0.7)}; } ${overlayMaskGradientStyles('180deg')}; +`; - /* - * Ensure the waveform is behind the other elements, e.g. headline, pill. - * Links define their own z-index. - */ - - > :not(.waveform):not(a) { - z-index: 1; +const immersiveOverlayBlurStyles = css` + ${from.tablet} { + padding: ${space[2]}px ${space[12]}px ${space[2]}px ${space[2]}px; + ${overlayMaskGradientStyles('270deg')} } `; const immersiveOverlayStyles = css` ${from.tablet} { height: 100%; - /** - * Why 48px right padding? - * 48px is to point at which the gradient can go behind the content whilst maintaining accessibility. - */ - padding: ${space[2]}px ${space[12]}px ${space[2]}px ${space[2]}px; - ${overlayMaskGradientStyles('270deg')} } `; @@ -214,9 +226,9 @@ const nonImmersivePodcastImageStyles = css` position: absolute; /** * Displays 8px above the text. - * desired space above text (8px) - padding-top of text container (64px) = -56px + * desired space above text (8px) - padding-top of text container (36px) = -28px */ - bottom: -${space[14]}px; + bottom: -28px; left: ${space[2]}px; `; @@ -245,7 +257,7 @@ const waveformStyles = css` bottom: 0; left: 0; z-index: 0; - height: 64px; + height: 40px; max-width: 100%; overflow: hidden; opacity: 0.3; @@ -297,7 +309,7 @@ const getMedia = ({ const renderWaveform = (duration: string, bars: number) => (
- +
); @@ -643,165 +655,186 @@ export const FeatureCard = ({ noPointerEvents, ]} > - {mainMedia?.type === 'Audio' && - !!mainMedia.podcastImage?.src && - (isImmersive ? ( - - {renderPodcastImage( +
+ {mainMedia?.type === 'Audio' && + !!mainMedia.podcastImage?.src && + (isImmersive ? ( + + {renderPodcastImage( + mainMedia.podcastImage + .src, + mainMedia.podcastImage + .altText ?? '', + false, // Immersive cards are styled as feature cards below the tablet viewport + )} + + ) : ( + renderPodcastImage( mainMedia.podcastImage.src, mainMedia.podcastImage .altText ?? '', - false, // Immersive cards are styled as feature cards below the tablet viewport - )} - - ) : ( - renderPodcastImage( - mainMedia.podcastImage.src, - mainMedia.podcastImage - .altText ?? '', - false, - ) - ))} -
- {/** Only the overlay is a link for self-hosted videos with controls. */} - {isSelfHostedVideoWithControls && ( - - )} + false, + ) + ))} +
- {isImmersive && - mainMedia?.type === 'Audio' && - !!mainMedia.podcastImage?.src && ( -
+ {/** Only the overlay is a link for self-hosted videos with controls. */} + {isSelfHostedVideoWithControls && ( + - - {renderPodcastImage( - mainMedia - .podcastImage - .src, - mainMedia - .podcastImage - .altText ?? '', - true, - )} - -
+ /> )} - {/** - * Without the wrapping div the headline and byline would have space - * inserted between them due to being direct children of the flex container - */} -
- + + {renderPodcastImage( + mainMedia + .podcastImage + .src, + mainMedia + .podcastImage + .altText ?? + '', + true, + )} + +
)} - /> -
- - {!isUndefined(starRating) && ( - - )} - {!!trailText && ( -
- +
- )} - - ) : undefined - } - commentCount={ - showCommentCount ? ( - - ) : undefined - } - showLivePlayable={false} - isNewsletter={isNewsletter} - mainMedia={mainMedia} - /> + {!isUndefined(starRating) && ( + + )} - {!isImmersive && - mainMedia?.type === 'Audio' && - renderWaveform( - mainMedia.duration, - 233, + {!!trailText && ( +
+ +
)} + + + ) : undefined + } + commentCount={ + showCommentCount ? ( + + ) : undefined + } + showLivePlayable={false} + isNewsletter={isNewsletter} + mainMedia={mainMedia} + /> + + {!isImmersive && + mainMedia?.type === 'Audio' && + renderWaveform( + mainMedia.duration, + 233, + )} +