Skip to content

Commit

Permalink
Merge pull request #3621 from open-formulieren/chore/3620-upgrade-sto…
Browse files Browse the repository at this point in the history
…rybook

Upgrade storybook to v7
  • Loading branch information
sergei-maertens authored Nov 21, 2023
2 parents 6d9710a + 55d7546 commit e3dc546
Show file tree
Hide file tree
Showing 74 changed files with 15,617 additions and 26,576 deletions.
28 changes: 21 additions & 7 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');

module.exports = {
stories: [
'../src/openforms/js/**/*.stories.mdx',
'../src/openforms/js/**/*.stories.@(js|jsx|ts|tsx)',
],
core: {
disableTelemetry: true,
disableWhatsNewNotifications: true,
},
stories: ['../src/openforms/js/**/*.mdx', '../src/openforms/js/**/*.stories.@(js|jsx|ts|tsx)'],

staticDirs: [
{from: '../static/admin', to: 'static/admin'},
{from: '../static/fonts', to: 'static/fonts'},
Expand All @@ -15,16 +17,24 @@ module.exports = {
{from: '../static/img', to: 'img'},
{from: '../public', to: ''},
],

addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'storybook-react-intl',
],
framework: '@storybook/react',
core: {
builder: '@storybook/builder-webpack5',
features: {
interactionsDebugger: true,
storyStoreV7: true,
buildStoriesJson: true,
},

framework: {
name: '@storybook/react-webpack5',
options: {},
},

webpackFinal: async (config, {configType}) => {
const isEnvProduction = configType === 'PRODUCTION';

Expand Down Expand Up @@ -71,4 +81,8 @@ module.exports = {
);
return config;
},

docs: {
autodocs: 'tag',
},
};
38 changes: 20 additions & 18 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import '../src/openforms/scss/screen.scss';
import '../src/openforms/scss/admin/admin_overrides.scss';
import {initialize, mswDecorator} from 'msw-storybook-addon';
import {initialize, mswDecorator, mswLoader} from 'msw-storybook-addon';
import {reactIntl} from './reactIntl.js';
import ReactModal from 'react-modal';

initialize({
onUnhandledRequest: 'bypass',
Expand All @@ -10,25 +11,26 @@ initialize({
},
});

export const parameters = {
reactIntl,
locale: reactIntl.defaultLocale,
locales: {
nl: 'Nederlands',
en: 'English',
},
actions: {argTypesRegex: '^on[A-Z].*'},
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
ReactModal.setAppElement(document.getElementById('storybook-root'));

export default {
decorators: [mswDecorator],
globals: {
locale: reactIntl.defaultLocale,
locales: {
nl: 'Nederlands',
en: 'English',
},
},
docs: {
source: {
type: 'dynamic',
excludeDecorators: true,
parameters: {
actions: {argTypesRegex: '^on[A-Z].*'},
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
reactIntl,
},
loaders: [mswLoader],
};
export const decorators = [mswDecorator];
Loading

0 comments on commit e3dc546

Please sign in to comment.