Skip to content

Commit

Permalink
chore: Use vite to build Storybook (#3581)
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr authored Aug 28, 2024
1 parent 44656c2 commit c4b3bf4
Show file tree
Hide file tree
Showing 17 changed files with 304 additions and 487 deletions.
21 changes: 0 additions & 21 deletions editor.planx.uk/.storybook/__mocks__/react-navi.js

This file was deleted.

17 changes: 17 additions & 0 deletions editor.planx.uk/.storybook/__mocks__/react-navi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {
useCurrentRoute as originalUseCurrentRoute,
useNavigation as originalUseNavigation,
} from "react-navi";

import type { Decorator } from "@storybook/react";

export const reactNaviDecorator: Decorator = (storyFn, context) => {
const { parameters } = context;

const useCurrentRoute =
parameters?.reactNavi?.useCurrentRoute || originalUseCurrentRoute;
const useNavigation =
parameters?.reactNavi?.useNavigation || originalUseNavigation;

return storyFn({ useCurrentRoute, useNavigation });
};
45 changes: 0 additions & 45 deletions editor.planx.uk/.storybook/main.js

This file was deleted.

18 changes: 18 additions & 0 deletions editor.planx.uk/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
stories: ["../src/**/*.stories.@(js|jsx|ts|tsx)"],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/preset-create-react-app",
"@storybook/addon-a11y",
],
staticDirs: ["../public"],
framework: {
name: "@storybook/react-vite",
options: {}
},
docs: {},
typescript: {
reactDocgen: "react-docgen-typescript"
}
};
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ThemeProvider, StyledEngineProvider } from "@mui/material/styles";
import { DndProvider } from "react-dnd";
import { HTML5Backend } from "react-dnd-html5-backend";
import { defaultTheme } from "../src/theme";
import React from "react";

import { reactNaviDecorator } from "./__mocks__/react-navi";

Expand All @@ -19,3 +20,4 @@ export const decorators = [
),
reactNaviDecorator,
];
export const tags = ["autodocs"];
File renamed without changes.
6 changes: 6 additions & 0 deletions editor.planx.uk/.storybook/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";

export default defineConfig({
plugins: [react()],
});
20 changes: 0 additions & 20 deletions editor.planx.uk/.storybook/webpack.config.js

This file was deleted.

4 changes: 2 additions & 2 deletions editor.planx.uk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@
"@storybook/node-logger": "^7.6.7",
"@storybook/preset-create-react-app": "^7.6.7",
"@storybook/react": "^7.6.7",
"@storybook/react-webpack5": "^7.6.7",
"@storybook/testing-library": "^0.2.2",
"@storybook/react-vite": "^7.6.7",
"@storybook/test": "^7.6.7",
"@storybook/theming": "^7.6.7",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^14.2.1",
Expand Down
Loading

0 comments on commit c4b3bf4

Please sign in to comment.