forked from iTwin/admin-components-react
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreview.js
More file actions
43 lines (39 loc) · 1.46 KB
/
Copy pathpreview.js
File metadata and controls
43 lines (39 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import addons from "@storybook/addons";
import { themes } from "@storybook/theming";
import { darkTheme, lightTheme } from "./itwinTheme";
// get an instance to the communication channel for the manager and preview
const channel = addons.getChannel();
// switch body class for story along with interface theme
channel.on("DARK_MODE", (isDark) => {
document.documentElement.setAttribute(
"data-theme",
isDark ? "dark" : "light"
);
document.documentElement.classList.add(
`iui-theme-${isDark ? "dark" : "light"}`
);
document.documentElement.classList.remove(
`iui-theme-${!isDark ? "dark" : "light"}`
);
});
export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
backgrounds: { disable: true },
controls: { expanded: true },
darkMode: {
dark: { ...themes.dark, ...darkTheme },
light: { ...themes.light, ...lightTheme },
},
docs: {
theme: { ...themes.light, ...lightTheme },
},
authClientConfig: {
clientId: process.env.STORYBOOK_AUTH_CLIENT_ID,
scope: ["imodels:read", "imodels:modify", "projects:read"].join(" "),
authority: "https://qa-ims.bentley.com",
},
};