-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpreview.js
52 lines (48 loc) · 1.14 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
48
49
50
51
52
import { theme as darkTheme } from '../src/theme/dark'
import { theme as lightTheme } from '../src/theme/light'
import { ThemeProvider } from '../src/theme/ThemeProvider'
import IotaWeb3Provider from '../src/web3/IotaWeb3Provider'
import { addDecorator } from '@storybook/react'
import { withThemes } from '@react-theming/storybook-addon'
import { Box } from '../src/components/layout/Box/Box'
import { CssBaseline } from '@mui/material'
export const parameters = {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/
}
}
}
const providerFn = ({ theme, children }) => {
return (
<IotaWeb3Provider>
<ThemeProvider theme={theme}>
<Box
sx={{
minHeight: '100vh',
bgcolor: 'background.paper',
p: 4
}}
>
{children}
<CssBaseline />
</Box>
</ThemeProvider>
</IotaWeb3Provider>
)
}
export const onThemeSwitch = (context) => {
const parameters = {
backgrounds: null
}
return {
parameters
}
}
addDecorator(
withThemes(null, [darkTheme, lightTheme], {
providerFn,
onThemeSwitch
})
)