Skip to content

Commit

Permalink
Add dark mode stories
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielCliftonGuardian committed Sep 19, 2024
1 parent ea9d90f commit 5653010
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dotcom-rendering/src/components/Answers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const radioButtonWrapperStyles = (theme: ArticleTheme) => css`
background-color: ${schemedPalette('--quiz-atom-answers-background')};
:hover {
background-color: ${palette.neutral[86]};
background-color: ${schemedPalette('--quiz-atom-answers-hover')};
}
/* TODO: apply same styles on focus (requires source update) */
Expand Down
35 changes: 34 additions & 1 deletion dotcom-rendering/src/components/KnowledgeQuizAtom.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { ArticleSpecial, Pillar } from '@guardian/libs';
import {
ArticleDesign,
ArticleDisplay,
ArticleSpecial,
Pillar,
} from '@guardian/libs';
import type { Meta, StoryObj } from '@storybook/react';
import { splitTheme } from '../../.storybook/decorators/splitThemeDecorator';
import {
exampleKnowledgeQuestions,
natureQuestions,
Expand All @@ -26,6 +32,15 @@ export const Default = {
sharingUrls,
theme: Pillar.News,
},
decorators: [
splitTheme([
{
display: ArticleDisplay.Standard,
design: ArticleDesign.Comment,
theme: Pillar.News,
},
]),
],
} satisfies Story;

export const BatchedResults = {
Expand All @@ -34,11 +49,29 @@ export const BatchedResults = {
questions: natureQuestions,
resultGroups: natureResultGroups,
},
decorators: [
splitTheme([
{
display: ArticleDisplay.Standard,
design: ArticleDesign.Comment,
theme: Pillar.News,
},
]),
],
} satisfies Story;

export const LabsTheme = {
args: {
...Default.args,
theme: ArticleSpecial.Labs,
},
decorators: [
splitTheme([
{
display: ArticleDisplay.Standard,
design: ArticleDesign.Comment,
theme: ArticleSpecial.Labs,
},
]),
],
} satisfies Story;
26 changes: 25 additions & 1 deletion dotcom-rendering/src/components/PersonalityQuizAtom.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { ArticleSpecial, Pillar } from '@guardian/libs';
import {
ArticleDesign,
ArticleDisplay,
ArticleSpecial,
Pillar,
} from '@guardian/libs';
import type { Meta, StoryObj } from '@storybook/react';
import { splitTheme } from '../../.storybook/decorators/splitThemeDecorator';
import {
examplePersonalityQuestions,
exampleResultBuckets,
Expand All @@ -24,6 +30,15 @@ export const Default = {
sharingUrls,
theme: Pillar.News,
},
decorators: [
splitTheme([
{
display: ArticleDisplay.Standard,
design: ArticleDesign.Comment,
theme: Pillar.News,
},
]),
],
} satisfies Story;

export const LabsTheme = {
Expand All @@ -32,4 +47,13 @@ export const LabsTheme = {
id: '2c6bf552-2827-4256-b3a0-f557d215c394',
theme: ArticleSpecial.Labs,
},
decorators: [
splitTheme([
{
display: ArticleDisplay.Standard,
design: ArticleDesign.Comment,
theme: ArticleSpecial.Labs,
},
]),
],
} satisfies Story;
4 changes: 4 additions & 0 deletions dotcom-rendering/src/palette.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6568,6 +6568,10 @@ const paletteColours = {
light: () => sourcePalette.neutral[97],
dark: () => sourcePalette.neutral[20],
},
'--quiz-atom-answers-hover': {
light: () => sourcePalette.neutral[86],
dark: () => sourcePalette.neutral[38],
},
'--quiz-atom-check-mark': {
light: () => sourcePalette.neutral[0],
dark: () => sourcePalette.neutral[97],
Expand Down

0 comments on commit 5653010

Please sign in to comment.