Update Storybook configuration and readme

This commit is contained in:
adilallo
2025-08-21 09:06:20 -06:00
parent b98fb11833
commit b284cbd385
7 changed files with 127 additions and 90 deletions
-5
View File
@@ -16,12 +16,7 @@ const config = {
options: {},
},
staticDirs: ["../public"],
managerHead: (head) => `${head}<base href="/communityrulestorybook/">`,
previewHead: (head) => `${head}<base href="/communityrulestorybook/">`,
async viteFinal(cfg) {
// IMPORTANT: Set base path for GitHub Pages sub-path hosting
cfg.base = "/communityrulestorybook/";
// Ensure esbuild treats .js as JSX during dep pre-bundling
cfg.optimizeDeps ??= {};
cfg.optimizeDeps.esbuildOptions ??= {};
+2 -49
View File
@@ -1,62 +1,15 @@
import "../app/globals.css";
/** @type { import('@storybook/nextjs-vite').Preview } */
/** @type { import('@storybook/react').Preview } */
const preview = {
parameters: {
nextjs: { appDirectory: true },
actions: { argTypesRegex: "^on[A-Z].*" },
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",
},
backgrounds: {
default: "dark",
values: [
{
name: "dark",
value: "#000000",
},
{
name: "light",
value: "#ffffff",
},
],
},
viewport: {
defaultViewport: "md",
viewports: {
xsm: {
name: "XSmall (≤429px)",
styles: { width: "429px", height: "800px" },
},
sm: {
name: "Small (≥430px)",
styles: { width: "430px", height: "800px" },
},
md: {
name: "Medium (≥640px)",
styles: { width: "640px", height: "800px" },
},
lg: {
name: "Large (≥1024px)",
styles: { width: "1024px", height: "800px" },
},
xl: {
name: "XLarge (≥1440px)",
styles: { width: "1440px", height: "900px" },
},
},
},
},
};