Skip to content

Commit d51eb7f

Browse files
authored
Merge branch 'main' into mod/dec/updateTests
2 parents 39af338 + 5fcfd4e commit d51eb7f

File tree

11 files changed

+1243
-1234
lines changed

11 files changed

+1243
-1234
lines changed

.storybook-constellation/main.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import path from 'path';
2+
3+
/** @type { import('@storybook/react-webpack5').StorybookConfig } */
4+
const config = {
5+
stories: ['../src/app/_components//custom-constellation/**/*.stories.@(js|jsx|ts|tsx)'],
6+
7+
typescript: {
8+
reactDocgen: 'react-docgen-typescript'
9+
},
10+
11+
addons: [
12+
'@storybook/addon-links',
13+
'@storybook/addon-essentials',
14+
{
15+
name: '@storybook/addon-docs',
16+
options: { mdxBabelOptions: { babelrc: true, configFile: true } }
17+
}
18+
],
19+
framework: '@storybook/react-webpack5',
20+
21+
webpackFinal: async config => {
22+
if (config.resolve?.alias) {
23+
config.resolve.alias['@pega/auth/lib/sdk-auth-manager'] = path.resolve(__dirname, '../__mocks__/authManager.tsx');
24+
}
25+
26+
if (config.module) {
27+
config.module.rules?.push(
28+
{
29+
test: /\.(d.ts)$/,
30+
loader: 'null-loader'
31+
},
32+
{
33+
test: /\.(map)$/,
34+
loader: 'null-loader'
35+
},
36+
{
37+
test: /\.tsx?$/,
38+
use: 'ts-loader',
39+
exclude: /node_modules/
40+
}
41+
);
42+
}
43+
44+
return config;
45+
}
46+
};
47+
48+
export default config;
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { Preview } from '@storybook/react';
2+
import { Configuration, PopoverManager, Toaster, ModalManager, WorkTheme } from '@pega/cosmos-react-core';
3+
import setPCoreMocks from '../__mocks__/pcoreMocks';
4+
5+
setPCoreMocks();
6+
7+
const decorators = [
8+
(Story, context) => {
9+
return (
10+
<Configuration>
11+
<PopoverManager>
12+
<Toaster dismissAfter={5000}>
13+
<ModalManager>
14+
<Story {...context} />
15+
</ModalManager>
16+
</Toaster>
17+
</PopoverManager>
18+
</Configuration>
19+
);
20+
}
21+
];
22+
23+
const parameters = {
24+
backgrounds: {
25+
default: 'App',
26+
values: [
27+
{
28+
name: 'App',
29+
value: WorkTheme.base.palette['app-background']
30+
},
31+
{
32+
name: 'Primary',
33+
value: WorkTheme.base.palette['primary-background']
34+
},
35+
{
36+
name: 'Secondary',
37+
value: WorkTheme.base.palette['secondary-background']
38+
}
39+
]
40+
},
41+
docs: {
42+
source: { type: 'code' },
43+
codePanel: true
44+
}
45+
};
46+
47+
const preview: Preview = {
48+
decorators,
49+
parameters
50+
};
51+
52+
export default preview;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"resolveJsonModule": true,
77
"emitDecoratorMetadata": false
88
},
9-
"exclude": ["../src/test.ts", "../src/**/*.spec.ts", "../src/app/_components/custom-constellation/**"],
9+
"exclude": ["../src/test.ts", "../src/**/*.spec.ts"],
1010
"include": ["../src/**/*", "./preview.ts", "../__mocks__/*"],
1111
"files": ["./typings.d.ts"]
1212
}

0 commit comments

Comments
 (0)