Skip to content

Commit

Permalink
Interactive atoms use light background in dark mode (#10291)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieB-gu authored Jan 29, 2024
1 parent 3ab6dd5 commit fdf7611
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 4 additions & 2 deletions dotcom-rendering/src/components/InteractiveAtom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import { css } from '@emotion/react';
import type { ArticleFormat } from '@guardian/libs';
import { ArticleDisplay } from '@guardian/libs';
import { unifyPageContent } from '../lib/unifyPageContent';
import { palette } from '../palette';

const containerStyles = css`
margin: 0;
`;

const fullWidthStyles = css`
const styles = css`
width: 100%;
background-color: ${palette('--interactive-atom-background')};
`;
const fullHeightStyles = css`
height: 100%;
Expand Down Expand Up @@ -42,7 +44,7 @@ export const InteractiveAtom = ({
title={title}
id={id}
css={[
fullWidthStyles,
styles,
isMainMedia &&
format.display === ArticleDisplay.Immersive &&
fullHeightStyles,
Expand Down
8 changes: 8 additions & 0 deletions dotcom-rendering/src/palette.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4862,6 +4862,10 @@ const lastUpdatedText: PaletteFunction = ({ theme, design }) => {
}
};

const interactiveAtomBackgroundLight: PaletteFunction = () => 'transparent';
const interactiveAtomBackgroundDark: PaletteFunction = () =>
sourcePalette.neutral[100];

// ----- Palette ----- //

/**
Expand Down Expand Up @@ -5745,6 +5749,10 @@ const paletteColours = {
light: lastUpdatedText,
dark: lastUpdatedText,
},
'--interactive-atom-background': {
light: interactiveAtomBackgroundLight,
dark: interactiveAtomBackgroundDark,
},
} satisfies PaletteColours;

/**
Expand Down

0 comments on commit fdf7611

Please sign in to comment.