Skip to content

Commit

Permalink
tailwind css theme POC
Browse files Browse the repository at this point in the history
  • Loading branch information
SerhiiTsybulskyi committed Mar 1, 2024
1 parent 751436c commit fdce5d0
Show file tree
Hide file tree
Showing 18 changed files with 1,027 additions and 41 deletions.
3 changes: 2 additions & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ const config: StorybookConfig = {
],
addons: [
'@storybook/addon-storysource',
'@storybook/addon-essentials'
'@storybook/addon-essentials',
'@storybook/addon-themes'
],
framework: {
name: '@storybook/react-vite',
Expand Down
20 changes: 16 additions & 4 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,25 @@
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: var(--body-color) !important;
background: var(--body-background) !important;
--icon-block-color: #fff;
--icon-block-background: #000;

&.light {
background: #e6e6e6;
}
&.dark {
background: var(--body-background);
}
}
.sb-show-main.sb-main-centered {
color: var(--body-color) !important;
background: var(--body-background) !important;

.light .sb-show-main.sb-main-centered {
color: var(--body-color);
background: #e6e6e6;
}

.dark .sb-show-main.sb-main-centered {
color: var(--body-color);
background: var(--body-background);
}
svg {
overflow: visible;
Expand Down
20 changes: 17 additions & 3 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
import { ThemeProvider, darkTheme } from '../src/utils/Theme';
import theme from './theme';
import { Preview } from '@storybook/react';
import { withThemeByClassName } from '@storybook/addon-themes';

import { ThemeProvider, darkTheme } from '../src/utils/Theme';
import { ThemeProvider as TWThemeProvider } from '../src/utils/Theme/TW';

import '../src/index.css';

const withProvider = (Story, context) => (
<ThemeProvider theme={darkTheme}>
<Story {...context} />
<TWThemeProvider>
<Story {...context} />
</TWThemeProvider>
</ThemeProvider>
);

const preview: Preview = {
decorators: [
withProvider
withProvider,
withThemeByClassName({
themes: {
light: 'light',
dark: 'dark',
},
defaultTheme: 'dark',
}),
],
parameters: {
layout: 'centered',
Expand Down
Loading

0 comments on commit fdce5d0

Please sign in to comment.