Skip to content

Commit

Permalink
Add dark mode to storybook (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
orzechdev committed Jan 21, 2022
1 parent 9f799e3 commit 751fbb9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = {
stories: ['../stories/**/*.stories.tsx', '../src/**/*.stories.tsx'],
stories: ["../stories/**/*.stories.tsx", "../src/**/*.stories.tsx"],
typescript: {
check: true, // type-check stories during Storybook build
},
addons: ["storybook-dark-mode"],
};
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
"react-dom": "^16.8.0 || ^17.0.0",
"react-is": "^17.0.2",
"size-limit": "^4.10.2",
"storybook-dark-mode": "^1.0.8",
"tslib": "^2.3.1",
"typescript": "^4.2.4",
"yargs": "^17.2.1"
Expand Down
3 changes: 2 additions & 1 deletion src/utils/Decorator.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import Card from "@material-ui/core/Card";
import CardContent from "@material-ui/core/CardContent";
import React from "react";
import { useDarkMode } from "storybook-dark-mode";

import { ThemeProvider } from "../theme";

export const Decorator = (storyFn: any) => (
<ThemeProvider>
<ThemeProvider defaultTheme={useDarkMode() ? "dark" : "light"}>
<div
style={{
padding: 24,
Expand Down

1 comment on commit 751fbb9

@vercel
Copy link

@vercel vercel bot commented on 751fbb9 Jan 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.