11import { css } from '@emotion/react' ;
2- import { breakpoints , from , space , until } from '@guardian/source/foundations' ;
3- import { ArticleDesign , type ArticleFormat } from '../lib/articleFormat' ;
2+ import {
3+ breakpoints ,
4+ from ,
5+ palette as sourcePalette ,
6+ space ,
7+ until ,
8+ } from '@guardian/source/foundations' ;
9+ import {
10+ ArticleDesign ,
11+ ArticleDisplay ,
12+ type ArticleFormat ,
13+ } from '../lib/articleFormat' ;
14+ import { transparentColour } from '../lib/transparentColour' ;
15+ import { palette } from '../palette' ;
416import type { FEElement , RoleType } from '../types/content' ;
517
618type Props = {
@@ -14,6 +26,32 @@ type Props = {
1426 isTimeline ?: boolean ;
1527} ;
1628
29+ const overlayMaskGradientStyles = ( angle : string ) => css `
30+ mask-image : linear-gradient(
31+ ${ angle } ,
32+ rgb (0 , 0 , 0 ) 0% ,
33+ rgba (0 , 0 , 0 , 0.9619 ) 12.5% ,
34+ rgba (0 , 0 , 0 , 0.8536 ) 25% ,
35+ rgba (0 , 0 , 0 , 0.6913 ) 37.5% ,
36+ rgba (0 , 0 , 0 , 0.5 ) 50% ,
37+ rgba (0 , 0 , 0 , 0.3087 ) 62.5% ,
38+ rgba (0 , 0 , 0 , 0.1464 ) 75% ,
39+ rgba (0 , 0 , 0 , 0.0381 ) 87.5% ,
40+ transparent 100%
41+ );
42+ ` ;
43+
44+ const blurStyles = css `
45+ position : absolute;
46+ inset : 0 ;
47+ background-color : ${ palette ( '--article-background' ) } ;
48+ backdrop-filter : blur (12px ) brightness (0.5 );
49+ @supports not (backdrop-filter : blur (12px )) {
50+ background-color : ${ transparentColour ( sourcePalette . neutral [ 10 ] , 0.7 ) } ;
51+ }
52+ ${ overlayMaskGradientStyles ( '0deg' ) } ;
53+ ` ;
54+
1755const roleCss = {
1856 inline : css `
1957 margin- to p: ${ space [ 3 ] } px;
@@ -273,6 +311,17 @@ export const Figure = ({
273311 return (
274312 < figure id = { id } key = { id } css = { mainMediaFigureStyles } >
275313 { children }
314+ { format . display === ArticleDisplay . Immersive && (
315+ < div
316+ css = { [
317+ blurStyles ,
318+ css `
319+ height : 40% ;
320+ top : 60% ;
321+ ` ,
322+ ] }
323+ />
324+ ) }
276325 </ figure >
277326 ) ;
278327 }
0 commit comments