diff --git a/frontend/.storybook/preview.tsx b/frontend/.storybook/preview.tsx index a34d881bc..a9b7868c6 100644 --- a/frontend/.storybook/preview.tsx +++ b/frontend/.storybook/preview.tsx @@ -1,8 +1,9 @@ +import { ArgTypes, Decorator, Parameters } from "@storybook/react"; import { useLayoutEffect } from "react"; import { createMemoryRouter, RouterProvider } from "react-router-dom"; import "../src/index.css"; -export const parameters = { +export const parameters: Parameters = { actions: { argTypesRegex: "^on[A-Z].*" }, controls: { matchers: { @@ -12,7 +13,7 @@ export const parameters = { }, }; -export const globalTypes = { +export const globalTypes: ArgTypes = { theme: { name: "Theme", description: "Global theme for components", @@ -35,7 +36,7 @@ export const globalTypes = { }, }; -const ThemeSwitcher = ({ theme }) => { +const ThemeSwitcher: React.FC<{ theme?: "light" | "dark" }> = ({ theme }) => { useLayoutEffect(() => { if (theme === "dark") { document.documentElement.classList.add("dark"); @@ -49,7 +50,7 @@ const ThemeSwitcher = ({ theme }) => { return null; }; -const withThemeProvider = (Story, context) => { +const withThemeProvider: Decorator = (Story, context) => { return ( <> @@ -58,7 +59,7 @@ const withThemeProvider = (Story, context) => { ); }; -const withRouter = (Story, context) => { +const withRouter: Decorator = (Story, _context) => { const router = createMemoryRouter([ { path: "/*", @@ -69,4 +70,4 @@ const withRouter = (Story, context) => { return ; }; -export const decorators = [withThemeProvider, withRouter]; +export const decorators: Decorator[] = [withThemeProvider, withRouter]; diff --git a/frontend/src/components/Block.stories.tsx b/frontend/src/components/Block.stories.tsx index 5cdfbf393..8aca7bc62 100644 --- a/frontend/src/components/Block.stories.tsx +++ b/frontend/src/components/Block.stories.tsx @@ -17,7 +17,7 @@ import type { Meta, StoryObj } from "@storybook/react"; import Block from "./Block"; import { Title, Subtitle, Body } from "./Typography"; -const meta: Meta = { +const meta = { title: "UI/Block", component: Block, subcomponents: { @@ -26,7 +26,7 @@ const meta: Meta = { Body, } as Record>, tags: ["docsPage"], -}; +} satisfies Meta; export default meta; type Story = StoryObj; diff --git a/frontend/src/components/Button.stories.ts b/frontend/src/components/Button.stories.ts index 774364c88..2d71a3a0a 100644 --- a/frontend/src/components/Button.stories.ts +++ b/frontend/src/components/Button.stories.ts @@ -16,7 +16,7 @@ import type { Meta, StoryObj } from "@storybook/react"; import Button from "./Button"; -const meta: Meta = { +const meta = { title: "UI/Button", component: Button, tags: ["docsPage"], @@ -32,7 +32,7 @@ const meta: Meta = { defaultValue: false, }, }, -}; +} satisfies Meta; export default meta; type Story = StoryObj; diff --git a/frontend/src/components/DateTime.stories.tsx b/frontend/src/components/DateTime.stories.tsx index beb11898e..ee9a76d28 100644 --- a/frontend/src/components/DateTime.stories.tsx +++ b/frontend/src/components/DateTime.stories.tsx @@ -19,7 +19,7 @@ import DateTime from "./DateTime"; const now = new Date(2022, 11, 16, 15, 32, 10); -const meta: Meta = { +const meta = { title: "UI/DateTime", component: DateTime, tags: ["docsPage"], @@ -35,7 +35,7 @@ const meta: Meta = { control: "date", }, }, -}; +} satisfies Meta; export default meta; type Story = StoryObj; diff --git a/frontend/src/components/LoadingScreen.stories.tsx b/frontend/src/components/LoadingScreen.stories.tsx index be4579999..987ec5c0d 100644 --- a/frontend/src/components/LoadingScreen.stories.tsx +++ b/frontend/src/components/LoadingScreen.stories.tsx @@ -16,11 +16,11 @@ import type { Meta, StoryObj } from "@storybook/react"; import LoadingScreen from "./LoadingScreen"; -const meta: Meta = { +const meta = { title: "UI/Loading Screen", component: LoadingScreen, tags: ["docsPage"], -}; +} satisfies Meta; export default meta; type Story = StoryObj; diff --git a/frontend/src/components/LoadingSpinner.stories.tsx b/frontend/src/components/LoadingSpinner.stories.tsx index 2a3bc6503..e08ea57e7 100644 --- a/frontend/src/components/LoadingSpinner.stories.tsx +++ b/frontend/src/components/LoadingSpinner.stories.tsx @@ -16,11 +16,11 @@ import type { Meta, StoryObj } from "@storybook/react"; import LoadingSpinner from "./LoadingSpinner"; -const meta: Meta = { +const meta = { title: "UI/Loading Spinner", component: LoadingSpinner, tags: ["docsPage"], -}; +} satisfies Meta; export default meta; type Story = StoryObj; diff --git a/frontend/src/components/OAuth2Session.stories.tsx b/frontend/src/components/OAuth2Session.stories.tsx index db0c1a169..c3811f24d 100644 --- a/frontend/src/components/OAuth2Session.stories.tsx +++ b/frontend/src/components/OAuth2Session.stories.tsx @@ -77,7 +77,7 @@ const Template: React.FC = ({ ); }; -const meta: Meta = { +const meta = { title: "Components/OAuth 2.0 Session", component: Template, tags: ["docsPage"], @@ -87,7 +87,7 @@ const meta: Meta = { clientName: "My client", clientUri: "https://example.com/", }, -}; +} satisfies Meta; export default meta; type Story = StoryObj; diff --git a/frontend/src/components/Typography.stories.tsx b/frontend/src/components/Typography.stories.tsx index a6b37c9cb..15014d197 100644 --- a/frontend/src/components/Typography.stories.tsx +++ b/frontend/src/components/Typography.stories.tsx @@ -16,14 +16,14 @@ import type { Meta, StoryObj } from "@storybook/react"; import Typography from "./Typography"; -const meta: Meta = { +const meta = { title: "UI/Typography", component: Typography, tags: ["docsPage"], args: { children: "Typography", }, -}; +} satisfies Meta; export default meta; type Story = StoryObj;