feat(ui): introduces storybook
- adds the necessary dependencies and configuration for Storybook. - refactors the `Button` component and adds some stories for it.
This commit is contained in:
32
pkgs/clan-app/ui/.storybook/main.ts
Normal file
32
pkgs/clan-app/ui/.storybook/main.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { createRequire } from "module";
|
||||
import { dirname, join } from "path";
|
||||
import { mergeConfig } from "vite";
|
||||
import type { StorybookConfig } from "@kachurun/storybook-solid-vite";
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const getAbsolutePath = (pkg: string) =>
|
||||
dirname(require.resolve(join(pkg, "package.json")));
|
||||
|
||||
const config: StorybookConfig = {
|
||||
stories: ["../src/components/**/*.mdx", "../src/components/**/*.stories.tsx"],
|
||||
addons: [
|
||||
getAbsolutePath("@storybook/addon-links"),
|
||||
getAbsolutePath("@storybook/addon-essentials"),
|
||||
getAbsolutePath("@chromatic-com/storybook"),
|
||||
getAbsolutePath("@storybook/addon-interactions"),
|
||||
],
|
||||
framework: {
|
||||
name: "@kachurun/storybook-solid-vite",
|
||||
options: {},
|
||||
},
|
||||
async viteFinal(config) {
|
||||
return mergeConfig(config, {
|
||||
define: { "process.env": {} },
|
||||
});
|
||||
},
|
||||
docs: {
|
||||
autodocs: "tag",
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
||||
Reference in New Issue
Block a user