From 1ec9b97b826b95017e58b798f5497ed5c22f7e53 Mon Sep 17 00:00:00 2001 From: Oliver Lloyd Date: Wed, 24 Nov 2021 16:25:38 +0000 Subject: [PATCH 1/4] fix: Only apply `fullHeightStyles` for main media when Immersive --- src/InteractiveAtom.stories.tsx | 15 +++++++++++++-- src/InteractiveAtom.tsx | 10 +++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/InteractiveAtom.stories.tsx b/src/InteractiveAtom.stories.tsx index ff284304..8c9a8009 100644 --- a/src/InteractiveAtom.stories.tsx +++ b/src/InteractiveAtom.stories.tsx @@ -6,6 +6,7 @@ import { MainMedia, } from './fixtures/InteractiveAtomBlockElement'; import { InteractiveAtom } from './InteractiveAtom'; +import { ArticleDesign, ArticleDisplay, ArticlePillar } from '@guardian/libs'; export default { title: 'InteractiveAtom', @@ -26,6 +27,11 @@ export const DefaultStory = (): JSX.Element => { elementHtml={html} elementJs={js} elementCss={atomCss} + format={{ + display: ArticleDisplay.Standard, + design: ArticleDesign.Standard, + theme: ArticlePillar.News, + }} /> ); @@ -35,7 +41,7 @@ DefaultStory.parameters = { chromatic: { disable: true }, }; -export const MainMediaStory = (): JSX.Element => { +export const ImmersiveMainMediaStory = (): JSX.Element => { const { id, html, js, css: atomCss } = MainMedia; return (
{ elementJs={js} elementCss={atomCss} isMainMedia={true} + format={{ + display: ArticleDisplay.Immersive, + design: ArticleDesign.Standard, + theme: ArticlePillar.News, + }} />
); }; -MainMedia.parameters = { +ImmersiveMainMediaStory.parameters = { // This interactive uses animation which is causing false negatives for Chromatic chromatic: { disable: true }, }; diff --git a/src/InteractiveAtom.tsx b/src/InteractiveAtom.tsx index 1e5f47e6..c4f73ddf 100644 --- a/src/InteractiveAtom.tsx +++ b/src/InteractiveAtom.tsx @@ -2,6 +2,7 @@ import React from 'react'; import { css } from '@emotion/react'; import { unifyPageContent } from './lib/unifyPageContent'; +import { ArticleDisplay, ArticleFormat } from '@guardian/libs'; const containerStyles = css` margin: 0; @@ -21,6 +22,7 @@ type InteractiveAtomType = { elementJs?: string; elementCss?: string; isMainMedia?: boolean; + format: ArticleFormat; }; export const InteractiveAtom = ({ @@ -29,6 +31,7 @@ export const InteractiveAtom = ({ elementJs, elementCss, isMainMedia, + format, }: InteractiveAtomType): JSX.Element => (