Skip to content

Commit

Permalink
feat(storybook): add experimental theme
Browse files Browse the repository at this point in the history
  • Loading branch information
Lena Rashkovan committed Sep 10, 2024
1 parent 6f5b1eb commit 2edf61b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useDarkMode } from 'storybook-dark-mode';

import { GlobalStyle as ClassicColors } from '../src/essentials/Colors/Colors';
import { GlobalStyle as ModernColors } from '../src/essentials/Colors/ModernColors';
import { createGlobalStyle, ColorPalette as ExperimentalColors } from '../src/essentials/experimental/Colors';
import { DarkScheme, LightScheme } from '../src/components/ColorScheme';

import { LightTheme, DarkTheme } from '../src/docs/storybook-theme/FreenowTheme';
Expand All @@ -16,7 +17,16 @@ const THEMES = {
} as const;

export const withTheme = (Story, context) => {
const Theme = THEMES[context.globals.theme];
const { theme } = context.globals;
const Theme =
theme === 'experimental'
? createGlobalStyle({
accent: ExperimentalColors.red['50'],
onAccent: ExperimentalColors.neutral['100'],
accentDark: ExperimentalColors.red['60'],
onAccentDark: ExperimentalColors.neutral['10']
})
: THEMES[theme];
return (
<>
<Theme />
Expand Down Expand Up @@ -136,7 +146,7 @@ export const preview: Preview = {
toolbar: {
title: 'Theme',
icon: 'paintbrush',
items: ['modern', 'classic'],
items: ['modern', 'classic', 'experimental'],
dynamicTitle: true
}
}
Expand Down

0 comments on commit 2edf61b

Please sign in to comment.