Skip to content

Commit

Permalink
refactor(theming): control via class
Browse files Browse the repository at this point in the history
  • Loading branch information
kripod committed Dec 11, 2023
1 parent 1ab9b12 commit 532af83
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
12 changes: 11 additions & 1 deletion .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
import "./styles.css";

import type { Preview } from "@storybook/react";
import { withThemeByClassName } from "@storybook/addon-themes";
import type { Preview, ReactRenderer } from "@storybook/react";

export default {
decorators: [
withThemeByClassName<ReactRenderer>({
themes: {
light: "theme-light",
dark: "theme-dark",
},
defaultTheme: "light",
}),
],
parameters: {
backgrounds: {
default: "neutral-0",
Expand Down
2 changes: 1 addition & 1 deletion src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

@layer base {
html {
@apply theme-light bg-ui-neutral-0 text-ui-neutral-5 dark:theme-dark;
@apply bg-ui-neutral-0 text-ui-neutral-5;
-webkit-tap-highlight-color: transparent;
}
}
1 change: 1 addition & 0 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ import tailwindPreset from "./src/tailwind-preset";
export default {
content: ["./src/**/*.{js,jsx,ts,tsx}"],
presets: [tailwindPreset],
darkMode: ["class", ".theme-dark"],
} satisfies Config;

0 comments on commit 532af83

Please sign in to comment.