Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 8 additions & 31 deletions dotcom-rendering/src/components/AdSlot.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
until,
} from '@guardian/source/foundations';
import { Hide } from '@guardian/source/react-components';
import type { FEArticle } from '../frontend/feArticle';
import { labelBoxStyles, labelHeight, labelStyles } from '../lib/adStyles';
import { ArticleDisplay } from '../lib/articleFormat';
import { center as layoutCenterStyles } from '../lib/center';
Expand Down Expand Up @@ -350,16 +349,19 @@ const liveBlogTopContainerStyles = css`
`;

const mobileStickyAdStyles = css`
z-index: ${getZIndex('mobileSticky')};
position: fixed;
bottom: 0;
width: 320px;
width: 100%;
margin: 0 auto;
right: 0;
left: 0;
z-index: ${getZIndex('mobileSticky')};
text-align: center;
background-color: ${schemedPalette('--ad-background')};
${from.phablet} {
display: none;
}

.ad-slot__close-button {
display: none;
position: absolute;
Expand Down Expand Up @@ -402,15 +404,6 @@ const mobileStickyAdStyles = css`
display: block;
position: relative;
${labelBoxStyles}
}
`;

const mobileStickyAdStylesFullWidth = css`
width: 100%;
text-align: center;
background-color: ${palette.neutral[97]};

.ad-slot[data-label-show='true']::before {
padding-left: calc((100% - ${adSizes.mobilesticky.width}px) / 2);
padding-right: calc((100% - ${adSizes.mobilesticky.width}px) / 2);
}
Expand Down Expand Up @@ -990,22 +983,6 @@ export const AdSlot = ({
}
};

type MobileStickyContainerProps = Pick<FEArticle, 'contentType' | 'pageId'>;

export const MobileStickyContainer = ({
contentType,
pageId,
}: MobileStickyContainerProps) => {
return (
<div
className="mobilesticky-container"
css={[
mobileStickyAdStyles,
(contentType === 'Article' ||
contentType === 'Interactive' ||
pageId.startsWith('football/')) &&
mobileStickyAdStylesFullWidth,
]}
/>
);
};
export const MobileStickyContainer = () => (
<div className="mobilesticky-container" css={mobileStickyAdStyles} />
);
8 changes: 3 additions & 5 deletions dotcom-rendering/src/layouts/AudioLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -734,11 +734,9 @@ export const AudioLayout = (props: WebProps | AppProps) => {
/>
</Island>
</BannerWrapper>
<MobileStickyContainer
data-print-layout="hide"
contentType={article.contentType}
pageId={article.pageId}
/>
{renderAds && (
<MobileStickyContainer data-print-layout="hide" />
)}
</>
)}
{isApps && (
Expand Down
7 changes: 3 additions & 4 deletions dotcom-rendering/src/layouts/CommentLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -918,10 +918,9 @@ export const CommentLayout = (props: WebProps | AppsProps) => {
/>
</Island>
</BannerWrapper>
<MobileStickyContainer
contentType={article.contentType}
pageId={article.pageId}
/>
{renderAds && (
<MobileStickyContainer data-print-layout="hide" />
)}
</>
)}
{isApps && (
Expand Down
6 changes: 1 addition & 5 deletions dotcom-rendering/src/layouts/CrosswordLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -513,11 +513,7 @@ export const CrosswordLayout = (props: Props) => {
/>
</Island>
</BannerWrapper>
<MobileStickyContainer
data-print-layout="hide"
contentType={article.contentType}
pageId={article.pageId}
/>
{renderAds && <MobileStickyContainer data-print-layout="hide" />}
</>
);
};
7 changes: 3 additions & 4 deletions dotcom-rendering/src/layouts/FullPageInteractiveLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,9 @@ export const FullPageInteractiveLayout = (props: WebProps | AppsProps) => {
/>
</Island>
</BannerWrapper>
<MobileStickyContainer
contentType={article.contentType}
pageId={article.pageId}
/>
{renderAds && (
<MobileStickyContainer data-print-layout="hide" />
)}
</>
)}
</>
Expand Down
5 changes: 1 addition & 4 deletions dotcom-rendering/src/layouts/ImmersiveLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1001,10 +1001,7 @@ export const ImmersiveLayout = (props: WebProps | AppProps) => {
</Island>
</BannerWrapper>
{renderAds && (
<MobileStickyContainer
contentType={article.contentType}
pageId={article.pageId}
/>
<MobileStickyContainer data-print-layout="hide" />
)}
</>
)}
Expand Down
8 changes: 3 additions & 5 deletions dotcom-rendering/src/layouts/InteractiveLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -810,11 +810,9 @@ export const InteractiveLayout = (props: WebProps | AppsProps) => {
/>
</Island>
</BannerWrapper>
<MobileStickyContainer
data-print-layout="hide"
contentType={article.contentType}
pageId={article.pageId}
/>
{renderAds && (
<MobileStickyContainer data-print-layout="hide" />
)}
</>
)}
{isApps && (
Expand Down
8 changes: 3 additions & 5 deletions dotcom-rendering/src/layouts/LiveLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1110,11 +1110,9 @@ export const LiveLayout = (props: WebProps | AppsProps) => {
/>
</Island>
</BannerWrapper>
<MobileStickyContainer
data-print-layout="hide"
contentType={article.contentType}
pageId={article.pageId}
/>
{renderAds && (
<MobileStickyContainer data-print-layout="hide" />
)}
</>
)}

Expand Down
6 changes: 1 addition & 5 deletions dotcom-rendering/src/layouts/NewsletterSignupLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -489,11 +489,7 @@ export const NewsletterSignupLayout = ({
</Section>

<BannerWrapper data-print-layout="hide" />
<MobileStickyContainer
data-print-layout="hide"
contentType={article.contentType}
pageId={article.pageId}
/>
{renderAds && <MobileStickyContainer data-print-layout="hide" />}
</>
);
};
7 changes: 3 additions & 4 deletions dotcom-rendering/src/layouts/PictureLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -763,10 +763,9 @@ export const PictureLayout = (props: WebProps | AppsProps) => {
/>
</Island>
</BannerWrapper>
<MobileStickyContainer
contentType={article.contentType}
pageId={article.pageId}
/>
{renderAds && (
<MobileStickyContainer data-print-layout="hide" />
)}
</>
)}
{isApps && (
Expand Down
8 changes: 3 additions & 5 deletions dotcom-rendering/src/layouts/StandardLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -816,11 +816,9 @@ export const StandardLayout = (props: WebProps | AppProps) => {
/>
</Island>
</BannerWrapper>
<MobileStickyContainer
data-print-layout="hide"
contentType={article.contentType}
pageId={article.pageId}
/>
{renderAds && (
<MobileStickyContainer data-print-layout="hide" />
)}
</>
)}

Expand Down
Loading