11import { css } from '@emotion/react' ;
2- import { from , space , until } from '@guardian/source/foundations' ;
2+ import { breakpoints , from , space , until } from '@guardian/source/foundations' ;
33import { ArticleDesign , type ArticleFormat } from '../lib/articleFormat' ;
44import type { FEElement , RoleType } from '../types/content' ;
55
66type Props = {
77 children : React . ReactNode ;
88 format : ArticleFormat ;
99 isMainMedia : boolean ;
10- role ?: RoleType | 'richLink' ;
10+ role ?: RoleType | 'richLink' | 'fullWidth' ;
1111 id ?: string ;
1212 className ?: string ;
1313 type ?: FEElement [ '_type' ] ;
@@ -70,6 +70,53 @@ const roleCss = {
7070 }
7171 ` ,
7272
73+ fullWidth : css `
74+ margin-top : ${ space [ 3 ] } px;
75+ margin-bottom : ${ space [ 3 ] } px;
76+
77+ ${ until . tablet } {
78+ margin-left : -20px ;
79+ margin-right : -20px ;
80+ }
81+ ${ until . mobileLandscape } {
82+ margin-left : -10px ;
83+ margin-right : -10px ;
84+ }
85+ ${ from . tablet } {
86+ --scrollbar-width-fallback : 15px ;
87+ --half-scrollbar-width-fallback : 7.5px ;
88+
89+ width : calc (
90+ 100vw - var (--scrollbar-width , var (--scrollbar-width-fallback ))
91+ );
92+ max-width : calc (
93+ 100vw - var (--scrollbar-width , var (--scrollbar-width-fallback ))
94+ );
95+
96+ --grid-container-max-width : 740px ;
97+ --grid-container-left-margin : calc (
98+ ((-100vw + (var (--grid-container-max-width ) - 42px )) / 2 ) +
99+ var (
100+ --half-scrollbar-width ,
101+ var (--half-scrollbar-width-fallback )
102+ )
103+ );
104+
105+ margin-left : var (--grid-container-left-margin );
106+ }
107+ ${ from . desktop } {
108+ --grid-container-max-width : ${ breakpoints . desktop } px;
109+ }
110+ ${ from . leftCol } {
111+ --grid-container-max-width : ${ breakpoints . leftCol } px;
112+ --grid-left-col-width : 140px ;
113+ }
114+ ${ from . wide } {
115+ --grid-container-max-width : ${ breakpoints . wide } px;
116+ --grid-left-col-width : 219px ;
117+ }
118+ ` ,
119+
73120 showcase : css `
74121 margin-top : ${ space [ 3 ] } px;
75122 margin-bottom : ${ space [ 3 ] } px;
@@ -150,7 +197,7 @@ const roleCss = {
150197
151198// Used for vast majority of layouts.
152199export const defaultRoleStyles = (
153- role : RoleType | 'richLink' ,
200+ role : RoleType | 'richLink' | 'fullWidth' ,
154201 format : ArticleFormat ,
155202 isTimeline = false ,
156203) => {
@@ -161,6 +208,8 @@ export const defaultRoleStyles = (
161208 return roleCss . supporting ;
162209 case 'immersive' :
163210 return roleCss . immersive ;
211+ case 'fullWidth' :
212+ return roleCss . fullWidth ;
164213 case 'showcase' :
165214 if ( isTimeline ) {
166215 return css `
0 commit comments