Skip to content

Commit

Permalink
Interactive Contents darkmode (#9925)
Browse files Browse the repository at this point in the history
* interactive contents dark mode
  • Loading branch information
DanielCliftonGuardian authored Jan 2, 2024
1 parent e4183b2 commit be91d32
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import { SvgChevronDownSingle } from '@guardian/source-react-components';
import { useCallback, useEffect, useState } from 'react';
import { getZIndex } from '../lib/getZIndex';
import { palette as themePalette } from '../palette';
import type { SubheadingBlockElement } from '../types/content';

const liStyles = css`
Expand All @@ -17,7 +18,7 @@ const liStyles = css`
border-top-style: solid;
border-top-color: ${sourcePalette.neutral[86]};
:hover {
background-color: ${sourcePalette.neutral[93]};
background-color: ${themePalette('--interactive-contents-hover')};
}
`;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { css } from '@emotion/react';
import { ArticleDesign, ArticleDisplay, Pillar } from '@guardian/libs';
import { splitTheme } from '../../.storybook/decorators/splitThemeDecorator';
import { NumberedList } from '../../fixtures/generated/articles/NumberedList';
import { enhanceInteractiveContentsElements } from '../model/enhance-interactive-contents-elements';
import type { InteractiveContentsBlockElement } from '../types/content';
Expand All @@ -15,6 +17,15 @@ const interactiveContentsBlock = enhanceInteractiveContentsElements(
export default {
component: InteractiveContentsBlockComponent,
title: 'Components/InteractiveContentsBlockElement',
decorators: [
splitTheme([
{
display: ArticleDisplay.Standard,
design: ArticleDesign.Standard,
theme: Pillar.News,
},
]),
],
};

export const Default = () =>
Expand Down
9 changes: 9 additions & 0 deletions dotcom-rendering/src/palette.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4510,6 +4510,11 @@ const paginationTextLight: PaletteFunction = ({ theme }) => {
};
const paginationTextDark: PaletteFunction = () => sourcePalette.neutral[86];

const interactiveContentsHoverLight: PaletteFunction = () =>
sourcePalette.neutral[93];
const interactiveContentsHoverDark: PaletteFunction = () =>
sourcePalette.neutral[10];

const audioAtomBackgroundLight: PaletteFunction = () =>
sourcePalette.neutral[97];
const audioAtomBackgroundDark: PaletteFunction = () =>
Expand Down Expand Up @@ -5453,6 +5458,10 @@ const paletteColours = {
light: paginationTextLight,
dark: paginationTextDark,
},
'--interactive-contents-hover': {
light: interactiveContentsHoverLight,
dark: interactiveContentsHoverDark,
},
'--audio-atom-background': {
light: audioAtomBackgroundLight,
dark: audioAtomBackgroundDark,
Expand Down

0 comments on commit be91d32

Please sign in to comment.