From 4f7ba294d9b9109b928ecf1f9ef4b95a740210fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Acid=20Chicken=20=28=E7=A1=AB=E9=85=B8=E9=B6=8F=29?= Date: Mon, 3 Apr 2023 11:03:19 +0900 Subject: [PATCH] docs(#10336): note about meta overriding and etc. --- CONTRIBUTING.md | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 64feddf8a2..fece05d7a9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -214,17 +214,14 @@ Misskey uses [Storybook](https://storybook.js.org/) for UI development. ##### Setup ```bash -cd path/to/packages/misskey-js -pnpm build -cd path/to/packages/frontend -pnpm tsc -p .storybook && (node .storybook/preload-locale.js & node .storybook/preload-theme.js) +pnpm --filter misskey-js build +pnpm --filter frontend tsc -p .storybook && (node packages/frontend/.storybook/preload-locale.js & node packages/frontend/.storybook/preload-theme.js) ``` ##### Run ```bash -cd path/to/packages/frontend -node .storybook/generate.js && pnpm storybook dev +node packages/frontend/.storybook/generate.js && pnpm --filter frontend storybook dev ``` #### macOS & Linux @@ -265,7 +262,7 @@ export const Default = { computed: { props() { return { - ...args, + ...this.args, }; }, }, @@ -288,7 +285,20 @@ import MyComponent from './MyComponent.vue'; void MyComponent; ``` -You can use msw to mock API requests in the storybook. Creating a `MyComponent.stories.msw.ts` file to define the mock handlers. +You can override the component meta by creating a meta story file (`MyComponent.stories.meta.ts`). + +```ts +export const argTypes = { + scale: { + control: { + type: 'range', + min: 1, + max: 4, + }, +}; +``` + +Also, you can use msw to mock API requests in the storybook. Creating a `MyComponent.stories.msw.ts` file to define the mock handlers. ```ts import { rest } from 'msw';