Skip to content

Commit 2a07017

Browse files
committed
Update for darkmode and some bug fixes.
1 parent fce1016 commit 2a07017

File tree

13 files changed

+506
-69
lines changed

13 files changed

+506
-69
lines changed

.storybook/preview.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

.storybook/preview.tsx

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import type { Preview } from "@storybook/react-vite";
2+
import "../src/index.css";
3+
4+
const preview: Preview = {
5+
parameters: {
6+
backgrounds: {
7+
options: {
8+
light: { name: "light", value: "#F7F9F2" }, // ライトテーマ用背景
9+
dark: { name: "dark", value: "#333" }, // ダークテーマ用背景
10+
},
11+
},
12+
controls: {
13+
matchers: {
14+
color: /(background|color)$/i,
15+
date: /Date$/i,
16+
},
17+
},
18+
19+
a11y: {
20+
// 'todo' - show a11y violations in the test UI only
21+
// 'error' - fail CI on a11y violations
22+
// 'off' - skip a11y checks entirely
23+
test: "todo",
24+
},
25+
},
26+
decorators: [
27+
(Story, context) => {
28+
const isDark = context.globals.backgrounds?.value === "dark";
29+
const html = document.documentElement;
30+
if (isDark) {
31+
html.classList.add("dark");
32+
} else {
33+
html.classList.remove("dark");
34+
}
35+
return <Story />;
36+
},
37+
],
38+
initialGlobals: {
39+
backgrounds: { value: "light" },
40+
},
41+
};
42+
43+
export default preview;

0 commit comments

Comments
 (0)