-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
storybook v6 -> v7 #1214
storybook v6 -> v7 #1214
Conversation
✅ Deploy Preview for ingred-ui ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
@@ -8,26 +8,25 @@ module.exports = { | |||
"@storybook/addon-essentials", | |||
"@storybook/addon-links", | |||
"@storybook/addon-storysource", | |||
"@storybook/addon-postcss", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v7では使えなさそう
storybookjs/storybook#20529
そもそもPostCSS使いたくていれたものじゃなさそう
https://github.com/voyagegroup/ingred-ui/blame/master/.storybook/main.js#L11
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ref: #1226
@@ -0,0 +1,23 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v7からは.babelrcを作ってそれを読むようになるっぽい
options: { | ||
sourceLoaderOptions: { | ||
csfPluginOptions: { | ||
injectStoryParameters: false, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@takurinton
pass
@@ -1,6 +1,5 @@ | |||
import * as React from "react"; | |||
import { ThemeProvider, createTheme } from "../src/themes"; | |||
import "@storybook/addon-console"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v7対応されなそう
storybookjs/storybook-addon-console#65
必要か判断した上で、代替手段を要調査
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
source codeが正しく表示されない displayNameをいれれば表示されそう。
追記(4/18) |
args table表示されない storybookjs/storybook#13304
追記(4/18) |
現状Storybook側がバグ対応中のステータス。なのでv7化においては、以下の方針が良いと気がした。
|
@@ -168,6 +168,7 @@ module.exports = { | |||
// I realize it's silly of me, but I'll turn it off here for the sake of specs for once. | |||
"jsx-a11y/click-events-have-key-events": "off", | |||
"jsx-a11y/no-static-element-interactions": "off", | |||
"react-hooks/rules-of-hooks": "off", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reactに状態をもたせる際、renderプロパティ内に関数を書く必要があり、この中でhooksを利用すると上記のエラーが出る。
いちいちエラーを消すのは手間であるため、*.stories.tsx
ではこのルールをoffにした。
@@ -67,15 +67,17 @@ describe("{{ inputs.name | pascal }} component testing", () => { | |||
|
|||
```typescript | |||
import * as React from "react"; | |||
import { Story } from "@storybook/react/types-6-0"; | |||
import { StoryObj } from "@storybook/react"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Storyは非推奨、v7化以降はオブジェクトで書く。
https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#story-type-deprecated
@@ -1,6 +1,5 @@ | |||
import * as React from "react"; | |||
import { ThemeProvider, createTheme } from "../src/themes"; | |||
import "@storybook/addon-console"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
options: { | ||
sourceLoaderOptions: { | ||
csfPluginOptions: { | ||
injectStoryParameters: false, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@takurinton
pass
@@ -14,7 +14,7 @@ export default { | |||
}, | |||
parameters: { | |||
docs: { | |||
source: { type: "code" }, | |||
source: { language: "tsx" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type: "code"
の場合、オブジェクトがそのまま表示されてしまい、docとしての役割としては実装サンプルが見えているはずなので、language: "tsx"にする。
ref: https://storybook.js.org/docs/angular/api/doc-block-source#language
color: "secondary", | ||
children: "secondary", | ||
export const Primary: StoryObj<typeof Badge> = { | ||
...Template, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
これまでTemplateはこんな感じに書く
ref: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
page: () => ( | ||
<> | ||
<Title /> | ||
<Subtitle /> | ||
<Description markdown="`<Divider />` is wrapper of `<hr />` tag that separate content into clear groups." /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
今日中にはレビューします!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scaffdog のところ以外は概ね良さそうです!!(そこだけ修正してもらえると)
.scaffdog/component.md
Outdated
export const Example: Story<{{ inputs.name | pascal }}Props> = (args) => ( | ||
<{{ inputs.name | pascal }} {...args} /> | ||
); | ||
export const Example: StoryStoryObj<{{ inputs.name | pascal }}Props> = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export const Example: StoryStoryObj<{{ inputs.name | pascal }}Props> = { | |
export const Example: StoryObj<{{ inputs.name | pascal }}Props> = { |
ありがとうございましたmmmmmmm |
This reverts commit 5d249d3.
目的