1- import React from ' react' ;
2- import { CssBaseline } from "@mui/material" ;
1+ import React from " react" ;
2+ import { CssBaseline } from "@mui/material" ;
33import type { Preview } from "@storybook/react" ;
44
5- import { ThemeProvider } from ' ../src'
6- import { GenericTheme , DiamondTheme } from ' ../src'
5+ import { ThemeProvider } from " ../src" ;
6+ import { GenericTheme , DiamondTheme } from " ../src" ;
77
8- import { ThemeSwapper , TextLight , TextDark } from "./ThemeSwapper" ;
8+ import { Context , ThemeSwapper , TextLight , TextDark } from "./ThemeSwapper" ;
99
10- const TextThemeBase = ' Theme: Generic'
11- const TextThemeDiamond = ' Theme: Diamond'
10+ const TextThemeBase = " Theme: Generic" ;
11+ const TextThemeDiamond = " Theme: Diamond" ;
1212
1313export const decorators = [
14- ( StoriesWithPadding :any ) => {
15- return < div style = { { padding : '2em' } } >
16- < StoriesWithPadding />
17- </ div >
14+ ( StoriesWithPadding : React . FC ) => {
15+ return (
16+ < div style = { { padding : "2em" } } >
17+ < StoriesWithPadding />
18+ </ div >
19+ ) ;
1820 } ,
19- ( StoriesWithThemeSwapping :any , context : any ) => {
20- return < ThemeSwapper context = { context } >
21- < StoriesWithThemeSwapping />
22- </ ThemeSwapper >
21+ ( StoriesWithThemeSwapping : React . FC , context : Context ) => {
22+ return (
23+ < ThemeSwapper context = { context } >
24+ < StoriesWithThemeSwapping />
25+ </ ThemeSwapper >
26+ ) ;
2327 } ,
24- ( StoriesWithThemeProvider :any , context :any ) => {
28+ ( StoriesWithThemeProvider : React . FC , context : Context ) => {
2529 const selectedTheme = context . globals . theme || TextThemeBase ;
2630 const selectedThemeMode = context . globals . themeMode || TextLight ;
2731
28- return < ThemeProvider
29- theme = { ( selectedTheme == TextThemeBase ) ? GenericTheme : DiamondTheme }
30- defaultMode = { ( selectedThemeMode == TextLight ) ? "light" : "dark" }
31- >
32- < CssBaseline />
33- < StoriesWithThemeProvider />
34- </ ThemeProvider >
32+ return (
33+ < ThemeProvider
34+ theme = { selectedTheme == TextThemeBase ? GenericTheme : DiamondTheme }
35+ defaultMode = { selectedThemeMode == TextLight ? "light" : "dark" }
36+ >
37+ < CssBaseline />
38+ < StoriesWithThemeProvider />
39+ </ ThemeProvider >
40+ ) ;
3541 } ,
3642] ;
3743
3844const preview : Preview = {
3945 globalTypes : {
4046 theme : {
41- description : ' Global theme for components' ,
47+ description : " Global theme for components" ,
4248 toolbar : {
43- title : ' Theme' ,
44- icon : ' cog' ,
49+ title : " Theme" ,
50+ icon : " cog" ,
4551 items : [ TextThemeBase , TextThemeDiamond ] ,
4652 dynamicTitle : true ,
4753 } ,
4854 } ,
4955 themeMode : {
50- description : ' Global theme mode for components' ,
56+ description : " Global theme mode for components" ,
5157 toolbar : {
52- title : ' Theme Mode' ,
53- icon : ' mirror' ,
58+ title : " Theme Mode" ,
59+ icon : " mirror" ,
5460 items : [ TextLight , TextDark ] ,
5561 dynamicTitle : true ,
5662 } ,
5763 } ,
5864 } ,
5965 initialGlobals : {
60- theme : ' Theme: Diamond' ,
61- themeMode : ' Mode: Light' ,
66+ theme : " Theme: Diamond" ,
67+ themeMode : " Mode: Light" ,
6268 } ,
6369 parameters : {
6470 controls : {
@@ -68,7 +74,7 @@ const preview: Preview = {
6874 } ,
6975 } ,
7076 backgrounds : { disable : true } ,
71- layout : ' fullscreen' ,
77+ layout : " fullscreen" ,
7278 } ,
7379} ;
7480
0 commit comments