diff --git a/dotcom-rendering/src/components/GridItem.tsx b/dotcom-rendering/src/components/GridItem.tsx index 42ac8857b2a..aba4f187131 100644 --- a/dotcom-rendering/src/components/GridItem.tsx +++ b/dotcom-rendering/src/components/GridItem.tsx @@ -1,4 +1,4 @@ -import { css } from '@emotion/react'; +import { css, type SerializedStyles } from '@emotion/react'; import { getZIndex } from '../lib/getZIndex'; type Props = { @@ -8,6 +8,7 @@ type Props = { * The element type to use. */ element?: 'div' | 'article' | 'main' | 'aside' | 'section'; + customCss?: SerializedStyles; }; const rightColumnStyles = css` @@ -36,12 +37,14 @@ export const GridItem = ({ children, area, element: Element = 'div', + customCss, }: Props) => ( ( +const InteractiveGrid = ({ + children, + topHat, +}: { + children: React.ReactNode; + topHat: 'regular' | 'fullWidth'; +}) => (
( grid-column-gap: 10px; - /* - Explanation of each unit of grid-template-columns - - Left Column (220 - 1px border) - Vertical grey border - Main content - */ ${from.wide} { grid-template-columns: 219px 1px 1020px; - - grid-template-areas: - 'title border headline' - '. border standfirst' - '. border media' - '. border media' - '. border lines' - '. border meta' - 'body body body' - '. . .'; + grid-template-areas: ${topHat === 'fullWidth' + ? `'media media media' + 'title border headline' + '. border standfirst' + '. border lines' + '. border meta' + 'body body body' + '. . .'` + : `'title border headline' + '. border standfirst' + '. border media' + '. border media' + '. border lines' + '. border meta' + 'body body body' + '. . .'`}; } - /* - Explanation of each unit of grid-template-columns - - Left Column (220 - 1px border) - Vertical grey border - Main content - */ ${until.wide} { grid-template-columns: 140px 1px 940px; - - grid-template-areas: - 'title border headline' - '. border standfirst' - '. border media' - '. border media' - '. border lines' - '. border meta' - 'body body body' - '. . .'; + grid-template-areas: ${topHat === 'fullWidth' + ? `'media media media' + 'title border headline' + '. border standfirst' + '. border lines' + '. border meta' + 'body body body' + '. . .'` + : `'title border headline' + '. border standfirst' + '. border media' + '. border media' + '. border lines' + '. border meta' + 'body body body' + '. . .'`}; } ${until.leftCol} { - grid-template-columns: 100%; /* Main content */ - grid-template-areas: - 'title' - 'headline' - 'standfirst' - 'media' - 'lines' - 'meta' - 'body' - '.'; + grid-template-columns: 100%; + grid-template-areas: ${topHat === 'fullWidth' + ? `'media' + 'title' + 'headline' + 'standfirst' + 'lines' + 'meta' + 'body' + '.'` + : `'title' + 'headline' + 'standfirst' + 'media' + 'lines' + 'meta' + 'body' + '.'`}; } ${until.desktop} { - grid-template-columns: 100%; /* Main content */ - grid-template-areas: - 'title' - 'headline' - 'standfirst' - 'media' - 'lines' - 'meta' - 'body'; + grid-template-columns: 100%; + grid-template-areas: ${topHat === 'fullWidth' + ? `'media' + 'title' + 'headline' + 'standfirst' + 'lines' + 'meta' + 'body'` + : `'title' + 'headline' + 'standfirst' + 'media' + 'lines' + 'meta' + 'body'`}; } ${until.tablet} { grid-column-gap: 0px; - grid-template-columns: 100%; /* Main content */ - grid-template-areas: - 'media' - 'title' - 'headline' - 'standfirst' - 'lines' - 'meta' - 'body'; + grid-template-columns: 100%; + grid-template-areas: ${topHat === 'fullWidth' + ? `'media' + 'title' + 'headline' + 'standfirst' + 'lines' + 'meta' + 'body'` + : `'media' + 'title' + 'headline' + 'standfirst' + 'lines' + 'meta' + 'body'`}; } } `} @@ -232,6 +258,8 @@ export const InteractiveLayout = (props: WebProps | AppsProps) => { }), ); + const topHat: 'regular' | 'fullWidth' = 'fullWidth'; + return ( <> {includesFullWidthElement && ( @@ -326,24 +354,39 @@ export const InteractiveLayout = (props: WebProps | AppsProps) => {
- - -
- -
+ + +