青いやつの進捗日記。

メモとしてべんきょうのしんちょくをかいていきます。あとで自分が検索しやすいもん

Storybook

【リンクメモ】Stotyrbook 白いコンポーネントの確認のため背景黒くする

https://storybook.js.org/docs/essentials/backgrounds import { WhiteButton } from './WhiteButton'; const meta: Meta<typeof WhiteButton> = { title: 'common/WhiteButton', component: WhiteButton, parameters: { backgrounds: { default: 'dark', }, }, };</typeof>

Storybookでdecolaterを使い、各Storyを共通のもので包む

storybook.js.org qiita.com decorators: [ Story => ( <div style={{ width: '216px' }}> <Story /> </div> ), ], これでこのコンポーネントのStoryは全てこのdivに包まれる。

Storybookの諸々の書き方まとめ

index.stories.tsx importする、Metaがいる import { Story, Meta } from '@storybook/react/types-6-0'; descriptionでStorybookの上の方にそのコンポーネントの説明が出る subComponent指定でこのStoryからそのコンポーネントも見れる export default { ti…