clan-app: Move changes for 2D view to separate ui-2d folder
This commit is contained in:
34
pkgs/clan-app/ui-2d/.storybook/main.ts
Normal file
34
pkgs/clan-app/ui-2d/.storybook/main.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
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("@storybook/addon-interactions"),
|
||||
],
|
||||
framework: {
|
||||
name: "@kachurun/storybook-solid-vite",
|
||||
options: {},
|
||||
},
|
||||
async viteFinal(config) {
|
||||
return mergeConfig(config, {
|
||||
define: { "process.env": {} },
|
||||
});
|
||||
},
|
||||
docs: {
|
||||
autodocs: "tag",
|
||||
},
|
||||
core: {
|
||||
disableTelemetry: true,
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
||||
5
pkgs/clan-app/ui-2d/.storybook/preview.css
Normal file
5
pkgs/clan-app/ui-2d/.storybook/preview.css
Normal file
@@ -0,0 +1,5 @@
|
||||
html {
|
||||
/* revert this which only makes sense when rendering inside the clan app webview */
|
||||
overflow-x: revert;
|
||||
overflow-y: revert;
|
||||
}
|
||||
29
pkgs/clan-app/ui-2d/.storybook/preview.ts
Normal file
29
pkgs/clan-app/ui-2d/.storybook/preview.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import type { Preview } from "@kachurun/storybook-solid";
|
||||
|
||||
import "@/src/components/v2/index.css";
|
||||
import "../src/index.css";
|
||||
import "./preview.css";
|
||||
|
||||
export const preview: Preview = {
|
||||
tags: ["autodocs"],
|
||||
parameters: {
|
||||
docs: { toc: true },
|
||||
backgrounds: {
|
||||
values: [
|
||||
{ name: "Dark", value: "#333" },
|
||||
{ name: "Light", value: "#ffffff" },
|
||||
],
|
||||
default: "Light",
|
||||
},
|
||||
// automatically create action args for all props that start with "on"
|
||||
actions: { argTypesRegex: "^on.*" },
|
||||
controls: {
|
||||
matchers: {
|
||||
color: /(background|color)$/i,
|
||||
date: /Date$/,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default preview;
|
||||
12
pkgs/clan-app/ui-2d/.storybook/test-runner.ts
Normal file
12
pkgs/clan-app/ui-2d/.storybook/test-runner.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { TestRunnerConfig } from "@storybook/test-runner";
|
||||
|
||||
const config: TestRunnerConfig = {
|
||||
async postVisit(page, context) {
|
||||
// the #storybook-root element wraps the story. In Storybook 6.x, the selector is #root
|
||||
const elementHandler = await page.$("#storybook-root");
|
||||
const innerHTML = await elementHandler.innerHTML();
|
||||
expect(innerHTML).toMatchSnapshot();
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
||||
Reference in New Issue
Block a user