Skip to content

Commit 6bef353

Browse files
committed
feat: integrate Storybook for Ability components and add stories
- Updated tsconfig.json to include Storybook configuration and story files. - Created main Storybook configuration in .storybook/main.ts. - Added preview configuration in .storybook/preview.js for Mantine styles and parameters. - Developed AbilityCard stories with mock data and decorators for context providers. - Implemented ThemeToggle stories with light and dark mode support. - Defined Zod schemas for ability tags in abilities_tags.zod.ts. - Created AbilityManualDetailPage stories with mock data and context. - Added tsconfig.storybook.json for Storybook-specific TypeScript settings.
1 parent 47fa281 commit 6bef353

13 files changed

Lines changed: 4153 additions & 34 deletions

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ coverage
1313
.cursor/rules/nx-rules.mdc
1414
.github/instructions/nx.instructions.md
1515
vite.config.*.timestamp*
16-
vitest.config.*.timestamp*
16+
vitest.config.*.timestamp*
17+
18+
storybook-static

.storybook/main.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import type { StorybookConfig } from '@storybook/react-vite';
2+
3+
const config: StorybookConfig = {
4+
stories: ['../src/**/*.@(mdx|stories.@(js|jsx|ts|tsx))'],
5+
addons: ['@storybook/addon-essentials', '@storybook/addon-interactions'],
6+
framework: {
7+
name: '@storybook/react-vite',
8+
options: {
9+
builder: {
10+
viteConfigPath: 'vite.config.ts',
11+
},
12+
},
13+
},
14+
};
15+
16+
export default config;
17+
18+
// To customize your Vite configuration you can use the viteFinal field.
19+
// Check https://storybook.js.org/docs/react/builders/vite#configuration
20+
// and https://nx.dev/recipes/storybook/custom-builder-configs

.storybook/preview.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import '@mantine/core/styles.css';
2+
import '@mantine/notifications/styles.css';
3+
import '@mantine/dates/styles.css';
4+
5+
const preview = {
6+
parameters: {
7+
actions: { argTypesRegex: "^on[A-Z].*" },
8+
controls: {
9+
matchers: {
10+
color: /(background|color)$/i,
11+
date: /Date$/i,
12+
},
13+
},
14+
backgrounds: {
15+
default: 'light',
16+
values: [
17+
{
18+
name: 'light',
19+
value: '#ffffff',
20+
},
21+
{
22+
name: 'dark',
23+
value: '#1A1B1E',
24+
},
25+
],
26+
},
27+
},
28+
};
29+
30+
export default preview;

.vscode/mcp.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@
1919
"cloudflare-docs": {
2020
"command": "npx",
2121
"args": ["mcp-remote", "https://docs.mcp.cloudflare.com/sse"]
22+
},
23+
"mantine": {
24+
"command": "npx",
25+
"args": ["@hakxel/mantine-ui-server"],
26+
"env": {
27+
"MANTINE_VERSION": "7.17.7" // Optional: specify version
28+
}
2229
}
2330
}
2431
}

nx.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@
1515
"buildDepsTargetName": "build-deps",
1616
"watchDepsTargetName": "watch-deps"
1717
}
18+
},
19+
{
20+
"plugin": "@nx/storybook/plugin",
21+
"options": {
22+
"serveStorybookTargetName": "storybook",
23+
"buildStorybookTargetName": "build-storybook",
24+
"testStorybookTargetName": "test-storybook",
25+
"staticStorybookTargetName": "static-storybook"
26+
}
1827
}
1928
]
2029
}

package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,18 @@
6060
"@nx/eslint": "^21.1.2",
6161
"@nx/js": "21.1.2",
6262
"@nx/react": "^21.1.2",
63+
"@nx/storybook": "21.1.2",
6364
"@nx/vite": "21.1.2",
6465
"@nx/web": "21.1.2",
6566
"@rollup/plugin-dynamic-import-vars": "^2.1.5",
67+
"@storybook/addon-essentials": "8.6.14",
68+
"@storybook/addon-interactions": "^8.6.11",
69+
"@storybook/core-server": "8.6.14",
70+
"@storybook/jest": "^0.2.3",
71+
"@storybook/react": "8.6.14",
72+
"@storybook/react-vite": "8.6.14",
73+
"@storybook/test-runner": "^0.22.0",
74+
"@storybook/testing-library": "^0.2.2",
6675
"@swc-node/register": "~1.9.1",
6776
"@swc/core": "~1.5.7",
6877
"@swc/helpers": "~0.5.11",
@@ -90,7 +99,9 @@
9099
"prettier": "^2.6.2",
91100
"rimraf": "^6.0.1",
92101
"rollup-plugin-visualizer": "^6.0.0",
102+
"storybook": "8.6.14",
93103
"terser": "^5.39.2",
104+
"ts-node": "10.9.1",
94105
"typescript": "^5.8.3",
95106
"vite-plugin-bundle-analyzer": "^0.0.1",
96107
"vite-plugin-compression": "^0.5.1",

0 commit comments

Comments
 (0)