forked from chanzuckerberg/sci-components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreview.js
47 lines (43 loc) · 1.33 KB
/
preview.js
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
44
45
46
47
import CssBaseline from "@mui/material/CssBaseline";
import { theme } from "../packages/components/src/core/styles";
import { ThemeProvider } from "@mui/material/styles";
export const decorators = [
(Story, context) => {
const { theme: storybookTheme } = context.globals;
return (
<ThemeProvider theme={theme(storybookTheme)}>
{/* CssBaseline provides light/dark background MUI theme for all stories */}
<CssBaseline />
<Story />
</ThemeProvider>
);
},
];
/**
* (thuang): This is a temporary fix for the Storybook addon to work with
* `storybook-addon-pseudo-states` plugin
* https://github.com/chromaui/storybook-addon-pseudo-states/issues/59#issuecomment-1498182067
*/
const preview = {
parameters: {
// Removes the change background button since it's controlled by the theme toggle
backgrounds: { disable: true },
},
globalTypes: {
pseudo: {},
theme: {
description: 'Global theme for components',
defaultValue: 'light',
toolbar: {
title: 'Theme',
icon: 'circlehollow',
dynamicTitle: true,
items: [
{ value: 'light', left: '☀️', title: 'Light mode' },
{ value: 'dark', left: '🌙', title: 'Dark mode' },
],
},
},
},
};
export default preview;