Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 11 additions & 15 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { CssBaseline } from '@mui/material';
import { getSdkComponentMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
import { theme } from '../src/theme';

import sdkConfig from '../sdk-config.json';
import { themes as sbThemes } from '@storybook/theming';

import { decorator } from '../__mocks__/react_pconnect';
import setPCoreMocks from '../__mocks__/pcoreMocks';

Expand All @@ -16,6 +19,10 @@ if (!isConstellation) {

setPCoreMocks();

const isDark = String(sdkConfig?.theme).toLowerCase() === 'dark';

const CANVAS_COLOR = (theme as any).backgroundColor || (isDark ? '#060326' : 'whitesmoke');

const decorators = [
(Story, context) => {
return isConstellation ? (
Expand All @@ -40,25 +47,14 @@ const decorators = [
decorator
];

const parameters = {
// 3) Set canvas and Docs chrome
const parameters: Preview['parameters'] = {
backgrounds: {
default: 'App',
values: [
{
name: 'App',
value: WorkTheme.base.palette['app-background']
},
{
name: 'Primary',
value: WorkTheme.base.palette['primary-background']
},
{
name: 'Secondary',
value: WorkTheme.base.palette['secondary-background']
}
]
values: [{ name: 'App', value: CANVAS_COLOR }]
},
docs: {
theme: isDark ? sbThemes.dark : sbThemes.light,
source: { type: 'code' },
codePanel: true
}
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"noImplicitAny": false,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"resolveJsonModule": true,

// Need to specify typeRoots to find the types and types to constrain
// where to look in @pega (to only get pcore-pconnect-typedefs)
Expand Down
Loading