Skip to content

Commit

Permalink
Update Storybook to v8 (#20)
Browse files Browse the repository at this point in the history
* fix ScrapGitHubReleaseTags story's tags fetch

* update to storybook v8 and a few fixes
  • Loading branch information
luclu7 authored May 4, 2024
1 parent 9d34720 commit 3a844eb
Show file tree
Hide file tree
Showing 36 changed files with 2,584 additions and 3,006 deletions.
4 changes: 2 additions & 2 deletions client/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import type { StorybookConfig } from "@storybook/react-vite";

const config: StorybookConfig = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
stories: ["../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
core: {
disableTelemetry: true, // 👈 Disables telemetry
},
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
"storybook-addon-react-router-v6",
"storybook-addon-remix-react-router",
],
framework: {
name: "@storybook/react-vite",
Expand Down
1 change: 0 additions & 1 deletion client/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import "../src/app/css/root.scss";

const preview: Preview = {
parameters: {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
Expand Down
5,428 changes: 2,497 additions & 2,931 deletions client/package-lock.json

Large diffs are not rendered by default.

21 changes: 11 additions & 10 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@
"react-router-dom": "^6.22.3"
},
"devDependencies": {
"@storybook/addon-essentials": "^7.6.17",
"@storybook/addon-interactions": "^7.6.17",
"@storybook/addon-links": "^7.6.17",
"@storybook/blocks": "^7.6.15",
"@storybook/react": "^7.6.15",
"@storybook/react-vite": "^7.6.17",
"@storybook/testing-library": "^0.2.2",
"@storybook/addon-essentials": "^8.0.8",
"@storybook/addon-interactions": "^8.0.8",
"@storybook/addon-links": "^8.0.8",
"@storybook/blocks": "^8.0.8",
"@storybook/preview-api": "^8.0.8",
"@storybook/react": "^8.0.8",
"@storybook/react-vite": "^8.0.8",
"@storybook/test": "^8.0.8",
"@types/react": "^18.2.75",
"@types/react-dom": "^18.2.24",
"@typescript-eslint/eslint-plugin": "^6.21.0",
Expand All @@ -41,10 +42,10 @@
"eslint": "^8.57.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.6",
"eslint-plugin-storybook": "^0.6.15",
"eslint-plugin-storybook": "^0.8.0",
"sass": "^1.74.1",
"storybook": "^7.6.17",
"storybook-addon-react-router-v6": "^2.0.15",
"storybook": "^8.0.8",
"storybook-addon-remix-react-router": "^3.0.0",
"typescript": "^5.4.4",
"vite": "^4.5.3"
},
Expand Down
6 changes: 4 additions & 2 deletions client/src/components/ActionsSettings.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import { ActionsSettings } from "./ActionsSettings";
import {
reactRouterParameters,
withRouter,
} from "storybook-addon-react-router-v6";
} from "storybook-addon-remix-react-router";
import { STORYBOOK_UPTODATEFORM } from "../../../src/Constants-dev";
import { fn } from "@storybook/test";

const meta = {
title: "Forms/ActionsSettings",
Expand All @@ -27,6 +28,7 @@ type Story = StoryObj<typeof meta>;
export const Primary: Story = {
args: {
activeUptodateForm: { ...STORYBOOK_UPTODATEFORM },
handleOnChange: () => {},
handleOnChange: fn(),
onDone: fn(),
},
};
2 changes: 1 addition & 1 deletion client/src/components/Badge.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Badge } from "./Badge";
import {
reactRouterParameters,
withRouter,
} from "storybook-addon-react-router-v6";
} from "storybook-addon-remix-react-router";

const meta = {
title: "Ui/Badge",
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Block.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Block } from "./Block";
import {
reactRouterParameters,
withRouter,
} from "storybook-addon-react-router-v6";
} from "storybook-addon-remix-react-router";

const meta = {
title: "Ui/Block",
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/CheckBox.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { CheckBox } from "./CheckBox";
import {
reactRouterParameters,
withRouter,
} from "storybook-addon-react-router-v6";
} from "storybook-addon-remix-react-router";

const meta = {
title: "Components/Input/CheckBox",
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/ConfirmDialog.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ConfirmDialog } from "./ConfirmDialog";
import {
reactRouterParameters,
withRouter,
} from "storybook-addon-react-router-v6";
} from "storybook-addon-remix-react-router";

const meta = {
title: "Ui/ConfirmDialog",
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Control.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Control } from "./Control";
import {
reactRouterParameters,
withRouter,
} from "storybook-addon-react-router-v6";
} from "storybook-addon-remix-react-router";
import { STORYBOOK_UPTODATEFORM } from "../../../src/Constants-dev";

const meta = {
Expand Down
4 changes: 3 additions & 1 deletion client/src/components/Dialog.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { Dialog } from "./Dialog";
import {
reactRouterParameters,
withRouter,
} from "storybook-addon-react-router-v6";
} from "storybook-addon-remix-react-router";
import { fn } from "@storybook/test";

const meta = {
title: "Ui/Dialog",
Expand All @@ -29,5 +30,6 @@ export const Primary: Story = {
visible: true,
header: "Header Dialog",
closeButton: true,
onHide: fn()
},
};
2 changes: 1 addition & 1 deletion client/src/components/FieldSet.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { FieldSet } from "./FieldSet";
import {
reactRouterParameters,
withRouter,
} from "storybook-addon-react-router-v6";
} from "storybook-addon-remix-react-router";

const meta = {
title: "Ui/FieldSet",
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/FieldSetApiEntrypoint.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { FieldSetApiEntrypoint } from "./FieldSetApiEntrypoint";
import {
reactRouterParameters,
withRouter,
} from "storybook-addon-react-router-v6";
} from "storybook-addon-remix-react-router";

const meta = {
title: "Ui/FieldSetApiEntrypoint",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { FieldSetAuthorizationHeader } from "./FieldSetAuthorizationHeader";
import {
reactRouterParameters,
withRouter,
} from "storybook-addon-react-router-v6";
} from "storybook-addon-remix-react-router";

const meta = {
title: "Ui/FieldSetAuthorizationHeader",
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/FieldSetClickableUrl.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { FieldSetClickableUrl } from "./FieldSetClickableUrl";
import {
reactRouterParameters,
withRouter,
} from "storybook-addon-react-router-v6";
} from "storybook-addon-remix-react-router";

const meta = {
title: "Ui/FieldSetClickableUrl",
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Header.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Header } from "./Header";
import {
reactRouterParameters,
withRouter,
} from "storybook-addon-react-router-v6";
} from "storybook-addon-remix-react-router";

const meta = {
title: "Components/Navigation/Header",
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/HttpHeader.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { HttpHeader } from "./HttpHeader";
import {
reactRouterParameters,
withRouter,
} from "storybook-addon-react-router-v6";
} from "storybook-addon-remix-react-router";

// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
const meta = {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/IconWithTooltip.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { IconWithTooltip } from "./IconWithTooltip";
import {
reactRouterParameters,
withRouter,
} from "storybook-addon-react-router-v6";
} from "storybook-addon-remix-react-router";

// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
const meta = {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/ImageUploader.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ImageUploader } from "./ImageUploader";
import {
reactRouterParameters,
withRouter,
} from "storybook-addon-react-router-v6";
} from "storybook-addon-remix-react-router";
import { useState } from "react";

const meta = {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/InputIcon.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { InputIcon } from "./InputIcon";
import {
reactRouterParameters,
withRouter,
} from "storybook-addon-react-router-v6";
} from "storybook-addon-remix-react-router";

const meta = {
title: "Components/Input/InputIcon",
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/LoginBlock.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { LoginBlock } from "./LoginBlock";
import {
reactRouterParameters,
withRouter,
} from "storybook-addon-react-router-v6";
} from "storybook-addon-remix-react-router";

const meta = {
title: "Forms/LoginBlock",
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/ResultCompare.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ResultCompare } from "./ResultCompare";
import {
reactRouterParameters,
withRouter,
} from "storybook-addon-react-router-v6";
} from "storybook-addon-remix-react-router";
import {
STORYBOOK_UPDATEORNOTSTATE,
STORYBOOK_UPTODATEFORM,
Expand Down
48 changes: 26 additions & 22 deletions client/src/components/ScrapGitHubReleaseTags.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,12 @@ import {
import {
reactRouterParameters,
withRouter,
} from "storybook-addon-react-router-v6";
} from "storybook-addon-remix-react-router";
import { useAppDispatch } from "../app/hook";
import { updateKeyUptodateFrom } from "../app/contextSlice";
import { UptodateForm, UptodateFormFields } from "../../../src/Global.types";
import { INITIALIZED_UPTODATEFORM } from "../../../src/Constants";

const meta = {
title: "Forms/ScrapGitHubReleaseTags",
component: ScrapGitHubReleaseTags,
decorators: [withRouter],
parameters: {
layout: "fullscreen",
reactRouter: reactRouterParameters({
location: { path: "/" },
}),
},
tags: ["autodocs"],
argTypes: {},
} satisfies Meta<typeof ScrapGitHubReleaseTags>;

export default meta;
type Story = StoryObj<typeof meta>;
import { fn } from "@storybook/test";

const releaseTagNameSample = [
{
Expand Down Expand Up @@ -109,16 +93,36 @@ const Component = (args: ScrapGitHubReleaseTagsProps) => {
};
return <ScrapGitHubReleaseTags {...args} />;
};
export const Primary: Story = {


const meta = {
title: "Forms/ScrapGitHubReleaseTags",
component: ScrapGitHubReleaseTags,
decorators: [withRouter],
parameters: {
layout: "fullscreen",
reactRouter: reactRouterParameters({
location: { path: "/" },
}),
},
args: {
activeUptodateForm: activeUptodateForm,
scrapUrl: (url: string) => {
console.log(url);
return new Promise((resolv) => {
resolv(releaseTagNameSample);
resolv(JSON.stringify(releaseTagNameSample));
});
},
onDone: (stepId) => console.log(stepId),
onDone: fn(),
handleOnChange: fn(),
displayError: fn(),
},
render: (args) => Component(args),
};
tags: ["autodocs"],
argTypes: {},
} satisfies Meta<typeof ScrapGitHubReleaseTags>;

export default meta;
type Story = StoryObj<typeof meta>;

export const Primary: Story = {};
14 changes: 8 additions & 6 deletions client/src/components/ScrapProduction.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import { ScrapProduction, ScrapProductionProps } from "./ScrapProduction";
import {
reactRouterParameters,
withRouter,
} from "storybook-addon-react-router-v6";
} from "storybook-addon-remix-react-router";
import { UptodateForm, UptodateFormFields } from "../../../src/Global.types";
import { INITIALIZED_UPTODATEFORM } from "../../../src/Constants";
import { useState } from "react";
import { fn } from "@storybook/test";

const meta = {
title: "Forms/ScrapProduction",
Expand All @@ -19,6 +20,11 @@ const meta = {
location: { path: "/" },
}),
},
args: {
onDone: fn(),
handleOnChange: fn(),
displayError: fn(),
},
tags: ["autodocs"],
argTypes: {},
} satisfies Meta<typeof ScrapProduction>;
Expand Down Expand Up @@ -61,8 +67,6 @@ export const ScrapAsText: Story = {
`);
});
},

onDone: () => {},
},
render: (args) => Component(args),
};
Expand All @@ -75,12 +79,10 @@ export const ScrapAsJSON: Story = {
resolv(
JSON.stringify({
version: "3.0.1",
})
}),
);
});
},

onDone: () => {},
},
render: (args) => Component(args),
};
2 changes: 1 addition & 1 deletion client/src/components/Search.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Search } from "./Search";
import {
reactRouterParameters,
withRouter,
} from "storybook-addon-react-router-v6";
} from "storybook-addon-remix-react-router";

// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
const meta = {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Stepper.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Stepper } from "./Stepper";
import {
reactRouterParameters,
withRouter,
} from "storybook-addon-react-router-v6";
} from "storybook-addon-remix-react-router";

const meta = {
title: "Components/Navigation/Stepper",
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/StepperStep.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { StepperStep } from "./StepperStep";
import {
reactRouterParameters,
withRouter,
} from "storybook-addon-react-router-v6";
} from "storybook-addon-remix-react-router";

const meta = {
title: "Components/Navigation/StepperStep",
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Summary.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Summary } from "./Summary";
import {
reactRouterParameters,
withRouter,
} from "storybook-addon-react-router-v6";
} from "storybook-addon-remix-react-router";
import { INITIALIZED_UPTODATEFORM } from "../../../src/Constants";
import { UptoDateOrNotState, UptodateForm } from "../../../src/Global.types";

Expand Down
Loading

0 comments on commit 3a844eb

Please sign in to comment.