diff --git a/.storybook/main.ts b/.storybook/main.ts new file mode 100644 index 00000000..86b75eb5 --- /dev/null +++ b/.storybook/main.ts @@ -0,0 +1,28 @@ +import type { StorybookConfig } from '@storybook/react-vite'; + +import { join, dirname } from "path" + +/** +* This function is used to resolve the absolute path of a package. +* It is needed in projects that use Yarn PnP or are set up within a monorepo. +*/ +function getAbsolutePath(value: string): any { + return dirname(require.resolve(join(value, 'package.json'))) +} +const config: StorybookConfig = { + "stories": [ + "../stories/**/*.mdx", + "../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)" + ], + "addons": [ + getAbsolutePath('@chromatic-com/storybook'), + getAbsolutePath('@storybook/addon-docs'), + getAbsolutePath("@storybook/addon-a11y"), + getAbsolutePath("@storybook/addon-vitest") + ], + "framework": { + "name": getAbsolutePath('@storybook/react-vite'), + "options": {} + } +}; +export default config; \ No newline at end of file diff --git a/.storybook/preview.ts b/.storybook/preview.ts new file mode 100644 index 00000000..9017263a --- /dev/null +++ b/.storybook/preview.ts @@ -0,0 +1,21 @@ +import type { Preview } from '@storybook/react-vite'; + +const preview: Preview = { + parameters: { + controls: { + matchers: { + color: /(background|color)$/i, + date: /Date$/i, + }, + }, + + a11y: { + // 'todo' - show a11y violations in the test UI only + // 'error' - fail CI on a11y violations + // 'off' - skip a11y checks entirely + test: 'todo', + }, + }, +}; + +export default preview; diff --git a/.storybook/vitest.setup.ts b/.storybook/vitest.setup.ts new file mode 100644 index 00000000..44922d55 --- /dev/null +++ b/.storybook/vitest.setup.ts @@ -0,0 +1,7 @@ +import * as a11yAddonAnnotations from "@storybook/addon-a11y/preview"; +import { setProjectAnnotations } from '@storybook/react-vite'; +import * as projectAnnotations from './preview'; + +// This is an important step to apply the right configuration when testing your stories. +// More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations +setProjectAnnotations([a11yAddonAnnotations, projectAnnotations]); \ No newline at end of file diff --git a/apps/client/src/App.tsx b/apps/client/src/App.tsx index c97741da..bd5f299c 100644 --- a/apps/client/src/App.tsx +++ b/apps/client/src/App.tsx @@ -16,7 +16,7 @@ function App() { React logo -

Vite + React

+

Vite + React

\