diff --git a/packages/profile/.storybook/preview.tsx b/packages/profile/.storybook/preview.tsx index 8b452575f..affc540df 100644 --- a/packages/profile/.storybook/preview.tsx +++ b/packages/profile/.storybook/preview.tsx @@ -1,5 +1,5 @@ import React from "react"; -import type { Preview, ReactRenderer } from "@storybook/react"; +import type { Decorator, Preview, ReactRenderer } from "@storybook/react"; import { withThemeByClassName } from "@storybook/addon-themes"; import { SonnerToaster } from "@cartridge/ui-next"; import { Provider } from "../src/components/provider"; @@ -7,6 +7,28 @@ import { Provider } from "../src/components/provider"; import "../src/index.css"; import { MemoryRouter, Route, Routes } from "react-router-dom"; +const routerDecorator: Decorator = (Story, { parameters: { router } }) => { + const params = router?.params || {} + const path = Object.keys(params).length + ? `/:${Object.keys(params).join("/:")}` + : "/" + const url = `/${Object.values(params).join("/")}` + + return ( + + + + } + /> + + + + + ); +}; + const preview: Preview = { parameters: { controls: { @@ -39,18 +61,7 @@ const preview: Preview = { }, defaultTheme: "dark", }), - (Story, - // { parameters } - ) => ( - - - - } /> - - - - - ), + routerDecorator, ], }; diff --git a/packages/profile/src/components/inventory/index.stories.tsx b/packages/profile/src/components/inventory/index.stories.tsx index 2ed90c06d..4b28e0157 100644 --- a/packages/profile/src/components/inventory/index.stories.tsx +++ b/packages/profile/src/components/inventory/index.stories.tsx @@ -5,6 +5,13 @@ import { decorator } from "@/hooks/account.mock"; const meta = { component: Inventory, + parameters: { + router: { + params: { + project: "test-0", + }, + }, + }, } satisfies Meta; export default meta; diff --git a/packages/profile/src/components/inventory/token/token.stories.tsx b/packages/profile/src/components/inventory/token/token.stories.tsx new file mode 100644 index 000000000..18462ab69 --- /dev/null +++ b/packages/profile/src/components/inventory/token/token.stories.tsx @@ -0,0 +1,13 @@ +import type { Meta, StoryObj } from "@storybook/react"; + +import { Token } from "./token"; + +const meta = { + component: Token, +} satisfies Meta; + +export default meta; + +type Story = StoryObj; + +export const Default: Story = {};