diff --git a/dotcom-rendering/src/components/Figure.tsx b/dotcom-rendering/src/components/Figure.tsx index e60a8560408..d86d06cafee 100644 --- a/dotcom-rendering/src/components/Figure.tsx +++ b/dotcom-rendering/src/components/Figure.tsx @@ -22,6 +22,58 @@ type Props = { articleArrangement?: LayoutType; }; +const fullWidthCss = ({ + leftColMaxWidth, + wideMaxWidth, +}: { + leftColMaxWidth: number; + wideMaxWidth: number; +}) => css` + margin-top: ${space[3]}px; + margin-bottom: ${space[3]}px; + + ${until.tablet} { + margin-left: -20px; + margin-right: -20px; + } + ${until.mobileLandscape} { + margin-left: -10px; + margin-right: -10px; + } + ${from.tablet} { + --scrollbar-width-fallback: 15px; + --half-scrollbar-width-fallback: 7.5px; + + width: calc( + 100vw - var(--scrollbar-width, var(--scrollbar-width-fallback)) + ); + max-width: calc( + 100vw - var(--scrollbar-width, var(--scrollbar-width-fallback)) + ); + + --grid-container-max-width: 740px; + --grid-container-left-margin: calc( + ((-100vw + (var(--grid-container-max-width) - 42px)) / 2) + + var( + --half-scrollbar-width, + var(--half-scrollbar-width-fallback) + ) + ); + margin-left: var(--grid-container-left-margin); + } + ${from.desktop} { + --grid-container-max-width: ${breakpoints.desktop}px; + } + ${from.leftCol} { + --grid-container-max-width: ${leftColMaxWidth}px; + --grid-left-col-width: 140px; + } + ${from.wide} { + --grid-container-max-width: ${wideMaxWidth}px; + --grid-left-col-width: 219px; + } +`; + const roleCss = { inline: css` margin-top: ${space[3]}px; @@ -78,59 +130,15 @@ const roleCss = { } `, - fullWidth: css` - margin-top: ${space[3]}px; - margin-bottom: ${space[3]}px; - - grid-column: 1 / -1; - `, + fullWidth: fullWidthCss({ + leftColMaxWidth: 824, + wideMaxWidth: 824, + }), - fullWidthDeprecated: css` - margin-top: ${space[3]}px; - margin-bottom: ${space[3]}px; - - ${until.tablet} { - margin-left: -20px; - margin-right: -20px; - } - ${until.mobileLandscape} { - margin-left: -10px; - margin-right: -10px; - } - ${from.tablet} { - --scrollbar-width-fallback: 15px; - --half-scrollbar-width-fallback: 7.5px; - - width: calc( - 100vw - var(--scrollbar-width, var(--scrollbar-width-fallback)) - ); - max-width: calc( - 100vw - var(--scrollbar-width, var(--scrollbar-width-fallback)) - ); - - --grid-container-max-width: 740px; - --grid-container-left-margin: calc( - ((-100vw + (var(--grid-container-max-width) - 42px)) / 2) + - var( - --half-scrollbar-width, - var(--half-scrollbar-width-fallback) - ) - ); - - margin-left: var(--grid-container-left-margin); - } - ${from.desktop} { - --grid-container-max-width: ${breakpoints.desktop}px; - } - ${from.leftCol} { - --grid-container-max-width: ${breakpoints.leftCol}px; - --grid-left-col-width: 140px; - } - ${from.wide} { - --grid-container-max-width: ${breakpoints.wide}px; - --grid-left-col-width: 219px; - } - `, + fullWidthDeprecated: fullWidthCss({ + leftColMaxWidth: breakpoints.leftCol, + wideMaxWidth: breakpoints.wide, + }), showcase: css` margin-top: ${space[3]}px; @@ -225,10 +233,9 @@ export const defaultRoleStyles = ( case 'immersive': return roleCss.immersive; case 'fullWidth': - if (isInDeprecatedInteractiveLayout) { - return roleCss.fullWidthDeprecated; - } - return roleCss.fullWidth; + return isInDeprecatedInteractiveLayout + ? roleCss.fullWidthDeprecated + : roleCss.fullWidth; case 'showcase': if (isTimeline) { return css` diff --git a/dotcom-rendering/src/components/SlotBodyEnd.island.tsx b/dotcom-rendering/src/components/SlotBodyEnd.island.tsx index ca41818bfa7..59e7ab7891b 100644 --- a/dotcom-rendering/src/components/SlotBodyEnd.island.tsx +++ b/dotcom-rendering/src/components/SlotBodyEnd.island.tsx @@ -13,7 +13,6 @@ import type { } from '@guardian/support-dotcom-components/dist/dotcom/types'; import type { EpicProps } from '@guardian/support-dotcom-components/dist/shared/types'; import { useEffect, useState } from 'react'; -import { grid } from '../grid'; import { getArticleCounts } from '../lib/articleCount'; import { BrazeBannersSystemPlacementId, @@ -53,19 +52,11 @@ type Props = { isLabs: boolean; articleEndSlot: boolean; isSensitive: boolean; - isInInteractive?: boolean; }; -const slotStyles = (isInInteractive: boolean) => css` +const slotStyles = css` color: ${palette.neutral[7]}; margin: 12px auto; - ${isInInteractive && - css` - ${grid.container}; - & > *:first-child { - ${grid.column.centre}; - } - `} `; const buildReaderRevenueEpicConfig = ( @@ -128,7 +119,6 @@ export const SlotBodyEnd = ({ isLabs, articleEndSlot, isSensitive, - isInInteractive = false, }: Props) => { const { renderingTarget } = useConfig(); const { brazeMessages, braze } = useBraze(idApiUrl, renderingTarget); @@ -272,7 +262,7 @@ export const SlotBodyEnd = ({ ) { const { SelectedMessage } = pickMessageResult; return ( -