diff --git a/packages/web/.storybook/main.js b/packages/web/.storybook/main.js new file mode 100644 index 0000000000..e5b11889f3 --- /dev/null +++ b/packages/web/.storybook/main.js @@ -0,0 +1,30 @@ +const path = require('path') + +module.exports = { + stories: [ + "../stories/**/*.stories.mdx", + "../stories/**/*.stories.@(js|jsx|ts|tsx)" + ], + addons: [ + "@storybook/addon-links", + "@storybook/addon-essentials", + "@storybook/addon-interactions", + "storybook-addon-next-router" + ], + framework: "@storybook/react", + core: { + builder: "webpack5" + }, + typescript: { + reactDocgen: false + }, + webpackFinal: async (config, { configType }) => { + config.resolve.roots = [ + path.resolve(__dirname, '../public'), + 'node_modules', + ]; + + // Return the altered config + return config; + }, +} diff --git a/packages/web/.storybook/preview.js b/packages/web/.storybook/preview.js new file mode 100644 index 0000000000..d7478763bc --- /dev/null +++ b/packages/web/.storybook/preview.js @@ -0,0 +1,42 @@ +import { RouterContext } from 'next/dist/shared/lib/router-context'; +import * as NextImage from 'next/image'; +import { getCssText } from '../components/tokens/stitches.config'; +import "../styles/globals.css"; + +const OriginalNextImage = NextImage.default; + +Object.defineProperty(NextImage, 'default', { + configurable: true, + value: props => +}) + +export const parameters = { + actions: { argTypesRegex: "^on[A-Z].*" }, + controls: { + matchers: { + color: /(background|color)$/i, + date: /Date$/, + }, + }, + nextRouter: { + Provider: RouterContext.Provider + } +} + +export const decorators = [ + (Story, context) => { + return ( + <> +