11import { css , Global } from '@emotion/react' ;
2- import { adSizes , constants } from '@guardian/commercial-core' ;
3- import { space } from '@guardian/source/foundations' ;
42import { palette } from '../palette' ;
5- import type { ServerSideTests } from '../types/config' ;
63import { AdSlot } from './AdSlot.web' ;
74import { Hide } from './Hide' ;
85
96const headerWrapper = css `
107 position : static;
118` ;
129
13- const { TOP_ABOVE_NAV_HEIGHT , AD_LABEL_HEIGHT } = constants ;
14-
15- const padding = space [ 4 ] + 2 ; // 18px - currently being reviewed
16- const borderBottomHeight = 1 ;
17- const headerMinHeight =
18- TOP_ABOVE_NAV_HEIGHT + padding + AD_LABEL_HEIGHT + borderBottomHeight ;
19-
20- const headerAdWrapperStylesVariant = css `
10+ const headerAdWrapperStyles = css `
2111 z-index : 1080 ;
2212 width : 100% ;
2313 background-color : ${ palette ( '--ad-background' ) } ;
@@ -31,32 +21,7 @@ const headerAdWrapperStylesVariant = css`
3121 top : 0 ;
3222` ;
3323
34- const headerAdWrapperStylesControl = css `
35- z-index : 1080 ;
36- width : 100% ;
37- background-color : ${ palette ( '--ad-background' ) } ;
38- min-height : ${ headerMinHeight } px;
39- border-bottom : 1px solid ${ palette ( '--ad-border' ) } ;
40-
41- display : flex;
42- flex-direction : column;
43- justify-content : center;
44-
45- position : sticky;
46- top : 0 ;
47- ` ;
48-
49- /**
50- * Ensure the top-above-nav/ad-block-ask containing div is always of a certain minimum height
51- */
52- const headerMinSizeStyles = css `
53- min-height : ${ adSizes . leaderboard . height } px;
54- min-width : ${ adSizes . leaderboard . width } px;
55- ` ;
56-
57- export const HeaderAdSlot = ( { abTests } : { abTests : ServerSideTests } ) => {
58- const isIn250ReservationVariant =
59- abTests . topAboveNav250ReservationVariant === 'variant' ;
24+ export const HeaderAdSlot = ( ) => {
6025 return (
6126 < div css = { headerWrapper } >
6227 < Global
@@ -74,23 +39,10 @@ export const HeaderAdSlot = ({ abTests }: { abTests: ServerSideTests }) => {
7439 />
7540 < Hide when = "below" breakpoint = "tablet" >
7641 < div
77- css = { [
78- isIn250ReservationVariant
79- ? headerAdWrapperStylesVariant
80- : headerAdWrapperStylesControl ,
81- ] }
42+ css = { headerAdWrapperStyles }
8243 className = "top-banner-ad-container"
8344 >
84- < div
85- css = { ! isIn250ReservationVariant && headerMinSizeStyles }
86- >
87- < AdSlot
88- position = "top-above-nav"
89- isIn250ReservationVariant = {
90- isIn250ReservationVariant
91- }
92- />
93- </ div >
45+ < AdSlot position = "top-above-nav" />
9446 </ div >
9547 </ Hide >
9648 </ div >
0 commit comments