Skip to content

Commit

Permalink
chore: improve storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
casperiv0 committed Oct 20, 2023
1 parent c6385bd commit 6b41293
Show file tree
Hide file tree
Showing 5 changed files with 219 additions and 1,052 deletions.
3 changes: 2 additions & 1 deletion packages/ui/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const config: StorybookConfig = {
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
"@storybook/addon-styling",
"@storybook/addon-themes",
"@storybook/addon-a11y",
],
framework: {
name: "@storybook/react-vite",
Expand Down
10 changes: 9 additions & 1 deletion packages/ui/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import * as React from "react";
import "../src/tailwind.css";
import type { Preview } from "@storybook/react";
import { withThemeByDataAttribute } from "@storybook/addon-styling";
import { withThemeByDataAttribute } from "@storybook/addon-themes";
import { NextIntlProvider } from "next-intl";

const preview: Preview = {
parameters: {
backgrounds: {
default: "dark",
values: [
{ name: "light", value: "#ffffff" },
{ name: "dark", value: "#16151a" },
],
},
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
Expand Down Expand Up @@ -44,6 +51,7 @@ export const decorators = [
light: "light",
dark: "dark",
},
parentSelector: "body",
defaultTheme: "dark",
attributeName: "data-theme",
}),
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
"test:e2e": "concurrently -k -s first -n \"SB,TEST\" -c \"magenta,blue\" \"http-server storybook-static --port 6006 --silent\" \"wait-on http-get://127.0.0.1:6006 -v && pnpm test-storybook\""
},
"devDependencies": {
"@storybook/addon-a11y": "^7.5.1",
"@storybook/addon-essentials": "^7.5.0",
"@storybook/addon-interactions": "^7.5.0",
"@storybook/addon-links": "^7.5.0",
"@storybook/addon-styling": "^1.3.7",
"@storybook/addon-themes": "^7.5.1",
"@storybook/blocks": "^7.5.0",
"@storybook/jest": "^0.2.3",
"@storybook/react": "^7.5.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/src/tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@tailwind components;
@tailwind utilities;

body[data-mode="dark"],
body[data-mode="dark"] {
body[data-theme="dark"] {
background-color: theme("colors.primary");
color: theme("colors.white");
}
Loading

0 comments on commit 6b41293

Please sign in to comment.