aboutsummaryrefslogtreecommitdiffstats
path: root/.storybook/main.ts
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-09-19 15:47:08 +0200
committerArmand Philippot <git@armandphilippot.com>2023-09-19 19:16:58 +0200
commit03331c44276ec56e9f235e4d5ee75030455a753f (patch)
treeb9248a7db3090e02bf38fe573f2ea973ed8a1561 /.storybook/main.ts
parent2faf2e34331703b3bdea3eb487cb8799c8d65377 (diff)
build(deps): bump all dependencies
* MDX type has changed so some components props had to be updated * Since Storybook now supports TS, I renamed the main/preview files
Diffstat (limited to '.storybook/main.ts')
-rw-r--r--.storybook/main.ts47
1 files changed, 47 insertions, 0 deletions
diff --git a/.storybook/main.ts b/.storybook/main.ts
new file mode 100644
index 0000000..8257c59
--- /dev/null
+++ b/.storybook/main.ts
@@ -0,0 +1,47 @@
+import type { StorybookConfig } from '@storybook/nextjs';
+import { RuleSetRule } from 'webpack';
+
+const config: StorybookConfig = {
+ stories: [
+ '../src/**!(content)/*.mdx',
+ '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)',
+ ],
+ addons: [
+ '@storybook/addon-links',
+ '@storybook/addon-essentials',
+ '@storybook/addon-interactions',
+ '@storybook/addon-onboarding',
+ 'storybook-dark-mode',
+ ],
+ framework: {
+ name: '@storybook/nextjs',
+ options: {},
+ },
+ docs: {
+ autodocs: 'tag',
+ },
+ staticDirs: ['../public'],
+ webpackFinal: async (config) => {
+ // Use SVGR for SVG files. See: https://medium.com/@derek_19900/config-storybook-4-to-use-svgr-webpack-plugin-22cb1152f004
+ const rules = config.module?.rules as RuleSetRule[];
+ const fileLoaderRule = rules.find(
+ (rule) => rule?.test instanceof RegExp && rule.test.test('.svg')
+ );
+
+ if (fileLoaderRule) fileLoaderRule.exclude = /\.svg$/;
+
+ rules.push({
+ test: /\.svg$/,
+ use: [{ loader: '@svgr/webpack', options: { dimensions: false } }],
+ });
+
+ /** @type {import('next').NextConfig} */
+ const nextConfig = require('../next.config');
+
+ return {
+ ...config,
+ ...nextConfig.webpack,
+ };
+ },
+};
+export default config;