File tree Expand file tree Collapse file tree 2 files changed +12
-15
lines changed
Expand file tree Collapse file tree 2 files changed +12
-15
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,9 @@ import { CssBaseline } from '@mui/material';
55import { getSdkComponentMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map' ;
66import { theme } from '../src/theme' ;
77
8+ import sdkConfig from '../sdk-config.json' ;
9+ import { themes as sbThemes } from '@storybook/theming' ;
10+
811import { decorator } from '../__mocks__/react_pconnect' ;
912import setPCoreMocks from '../__mocks__/pcoreMocks' ;
1013
@@ -16,6 +19,10 @@ if (!isConstellation) {
1619
1720setPCoreMocks ( ) ;
1821
22+ const isDark = String ( sdkConfig ?. theme ) . toLowerCase ( ) === 'dark' ;
23+
24+ const CANVAS_COLOR = ( theme as any ) . backgroundColor || ( isDark ? '#060326' : 'whitesmoke' ) ;
25+
1926const decorators = [
2027 ( Story , context ) => {
2128 return isConstellation ? (
@@ -40,25 +47,14 @@ const decorators = [
4047 decorator
4148] ;
4249
43- const parameters = {
50+ // 3) Set canvas and Docs chrome
51+ const parameters : Preview [ 'parameters' ] = {
4452 backgrounds : {
4553 default : 'App' ,
46- values : [
47- {
48- name : 'App' ,
49- value : WorkTheme . base . palette [ 'app-background' ]
50- } ,
51- {
52- name : 'Primary' ,
53- value : WorkTheme . base . palette [ 'primary-background' ]
54- } ,
55- {
56- name : 'Secondary' ,
57- value : WorkTheme . base . palette [ 'secondary-background' ]
58- }
59- ]
54+ values : [ { name : 'App' , value : CANVAS_COLOR } ]
6055 } ,
6156 docs : {
57+ theme : isDark ? sbThemes . dark : sbThemes . light ,
6258 source : { type : 'code' } ,
6359 codePanel : true
6460 }
Original file line number Diff line number Diff line change 1313 "noImplicitAny" : false ,
1414 "allowSyntheticDefaultImports" : true ,
1515 "esModuleInterop" : true ,
16+ "resolveJsonModule" : true ,
1617
1718 // Need to specify typeRoots to find the types and types to constrain
1819 // where to look in @pega (to only get pcore-pconnect-typedefs)
You can’t perform that action at this time.
0 commit comments