Last active
January 29, 2025 02:47
-
Star
(148)
You must be signed in to star a gist -
Fork
(10)
You must be signed in to fork a gist
Revisions
-
shilman revised this gist
Apr 21, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -54,7 +54,7 @@ module.exports = ["@storybook/preset-create-react-app", ...]; yarn storybook ``` Then edit the button label in `./src/stories/1-Button.stories.tsx` and verify that the story updates in Storybook. Also verify that there's a `Docs` tab, and that it shows something reasonable-ish. We'll make it better in the next step. -
shilman revised this gist
Apr 21, 2020 . 1 changed file with 5 additions and 7 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,8 +26,6 @@ yarn add @storybook/addon-docs --dev Then edit `./.storybook/main.js`: ```js module.exports = { stories: ["../src/stories/**/*.stories.(ts|tsx|js|jsx)"], addons: [ @@ -37,10 +35,10 @@ module.exports = { { name: "@storybook/addon-docs", options: { configureJSX: true, }, }, ], }; ``` @@ -96,7 +94,7 @@ You already installed docs in Step 3, but now you need to tell Storybook to load ```js module.exports = { stories: ["../src/stories/**/*.stories.(ts|tsx|js|jsx|mdx)"], // more settings ... }; ``` -
shilman revised this gist
Apr 14, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ The purpose of this walkthrough is a streamlined Typescript / Docs setup that wo ## Step 1: Initialize CRA w/ TS ```sh npx create-react-app cra-ts --template typescript ``` ## Step 2: Initialize Storybook w/ TS -
shilman revised this gist
Mar 6, 2020 . No changes.There are no files selected for viewing
-
shilman revised this gist
Mar 6, 2020 . 1 changed file with 5 additions and 3 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -65,14 +65,16 @@ Also verify that there's a `Docs` tab, and that it shows something reasonable-is Storybook can't load docgen information from pre-built libraries, so to test that aspect out, create a file `./src/stories/Button.tsx`: ```tsx import React, { FC, ReactNode } from "react"; type ButtonProps = { children: ReactNode; /** * Simple click handler */ onClick?: () => void; }; /** * The world's most _basic_ button -
shilman revised this gist
Mar 6, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -77,7 +77,7 @@ interface ButtonProps { /** * The world's most _basic_ button */ export const Button: FC<ButtonProps> = ({ children, onClick }: ButtonProps) => ( <button onClick={onClick} type="button"> {children} </button> -
shilman revised this gist
Mar 6, 2020 . No changes.There are no files selected for viewing
-
shilman revised this gist
Mar 6, 2020 . 1 changed file with 2 additions and 9 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -33,14 +33,7 @@ module.exports = { addons: [ "@storybook/addon-actions", "@storybook/addon-links", "@storybook/preset-create-react-app", { name: "@storybook/addon-docs", options: { @@ -54,7 +47,7 @@ module.exports = { > NOTE: If you're using an older version of Storybook or otherwise prefer `.storybook/presets.js`, you can use export the value of `presets` from the above example instead: ```js module.exports = ["@storybook/preset-create-react-app", ...]; ``` ## Step 4: Verify Installation -
shilman revised this gist
Feb 18, 2020 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,13 +14,13 @@ npx create-react-app cra-ts --typescript ```sh cd cra-ts npx -p @storybook/cli sb init --story-format=csf-ts ``` ## Step 3: Install & Configure Docs ```sh yarn add @storybook/addon-docs --dev ``` Then edit `./.storybook/main.js`: -
shilman revised this gist
Jan 1, 2020 . 1 changed file with 3 additions and 5 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -31,10 +31,8 @@ const path = require("path"); module.exports = { stories: ["../src/stories/**/*.stories.(ts|tsx|js|jsx)"], addons: [ "@storybook/addon-actions", "@storybook/addon-links", { name: "@storybook/preset-create-react-app", options: { @@ -44,7 +42,7 @@ module.exports = { } }, { name: "@storybook/addon-docs", options: { configureJSX: true } -
shilman revised this gist
Dec 23, 2019 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -53,7 +53,11 @@ module.exports = { }; ``` > NOTE: If you're using an older version of Storybook or otherwise prefer `.storybook/presets.js`, you can use export the value of `presets` from the above example instead: ```js module.exports = [{ name: "@storybook/preset-create-react-app", ... }, ...]; ``` ## Step 4: Verify Installation -
shilman revised this gist
Dec 23, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -95,7 +95,7 @@ Then update `./src/stories/1-Button.stories.tsx` to import this button instead o Finally, test that MDX is working. You already installed docs in Step 3, but now you need to tell Storybook to load `.stories.mdx` files by editing `.storybook/main.js`: ```js module.exports = { -
shilman revised this gist
Dec 23, 2019 . 1 changed file with 40 additions and 22 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -23,29 +23,38 @@ npx -p @storybook/cli@next sb init --story-format=csf-ts yarn add @storybook/addon-docs@next --dev ``` Then edit `./.storybook/main.js`: ```js const path = require("path"); module.exports = { stories: ["../src/stories/**/*.stories.(ts|tsx|js|jsx)"], addons: [ "@storybook/addon-actions/register", "@storybook/addon-links/register" ], presets: [ { name: "@storybook/preset-create-react-app", options: { tsDocgenLoaderOptions: { tsconfigPath: path.resolve(__dirname, "../tsconfig.json") } } }, { name: "@storybook/addon-docs/preset", options: { configureJSX: true } } ] }; ``` > NOTE: If you're using an older version of Storybook or otherwise prefer `.storybook/presets.js`, you can use export the value of `presets` from the above example instead. ## Step 4: Verify Installation ```sh @@ -86,15 +95,13 @@ Then update `./src/stories/1-Button.stories.tsx` to import this button instead o Finally, test that MDX is working. You already installed docs in Step 3, but now you need to tell Storybook to load `.stories.mdx` files by editing ```js module.exports = { stories: ["../src/stories/**/*.stories.(ts|tsx|js|jsx|mdx)"] // more settings ... }; ``` Then create `./src/stories/Test.stories.mdx`: @@ -122,6 +129,17 @@ Here's some _markdown_! You should see a new entry in your Storybook's navigation, a story, and the documentation you wrote in the `Docs` tab. > NOTE: If you're using an older version of Storybook or otherwise prefer `.storybook/config.[jt]s`, you can add the stories to your configure statement: ```js import { configure } from "@storybook/react"; configure( require.context("../src/stories", true, /\.stories\.(mdx|[tj]sx?)$/), module ); ``` ## Notes The `sourceLoaderOptions: null` in `Step 3` is covering up Storybook issue #7829: [Addon-docs: Typescript source support](https://github.com/storybookjs/storybook/issues/7829). I'll fix that issue ASAP to complete the walkthrough and update this gist when it's ready. -
shilman revised this gist
Dec 14, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,13 +14,13 @@ npx create-react-app cra-ts --typescript ```sh cd cra-ts npx -p @storybook/cli@next sb init --story-format=csf-ts ``` ## Step 3: Install & Configure Docs ```sh yarn add @storybook/addon-docs@next --dev ``` Then edit `./.storybook/presets.js`: -
shilman revised this gist
Dec 14, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,7 +20,7 @@ npx -p @storybook/cli@5.3.0-beta.15 sb init --story-format=csf-ts ## Step 3: Install & Configure Docs ```sh yarn add @storybook/addon-docs --dev ``` Then edit `./.storybook/presets.js`: -
shilman revised this gist
Dec 11, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,13 +14,13 @@ npx create-react-app cra-ts --typescript ```sh cd cra-ts npx -p @storybook/cli@5.3.0-beta.15 sb init --story-format=csf-ts ``` ## Step 3: Install & Configure Docs ```sh yarn add @storybook/addon-docs@5.3.0-beta.15 --dev ``` Then edit `./.storybook/presets.js`: -
shilman revised this gist
Dec 2, 2019 . No changes.There are no files selected for viewing
-
shilman revised this gist
Dec 2, 2019 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -38,10 +38,9 @@ module.exports = [ } }, { name: "@storybook/addon-docs/preset", options: { configureJSX: true, } } ]; -
shilman revised this gist
Oct 19, 2019 . 1 changed file with 25 additions and 0 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -98,6 +98,31 @@ configure( ); ``` Then create `./src/stories/Test.stories.mdx`: ``` import { Meta, Story, Preview, Props } from "@storybook/addon-docs/blocks"; import { Button } from "./Button"; <Meta title="Test" /> Here's some _markdown_! # Preview <Preview> <Story name="button"> <Button>hello</Button> </Story> </Preview> # Props <Props of={Button} /> ``` You should see a new entry in your Storybook's navigation, a story, and the documentation you wrote in the `Docs` tab. ## Notes The `sourceLoaderOptions: null` in `Step 3` is covering up Storybook issue #7829: [Addon-docs: Typescript source support](https://github.com/storybookjs/storybook/issues/7829). I'll fix that issue ASAP to complete the walkthrough and update this gist when it's ready. -
shilman revised this gist
Oct 19, 2019 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -90,6 +90,8 @@ Finally, test that MDX is working. You already installed docs in Step 3, but now you need to tell Storybook to load `.stories.mdx` files by editing `.storybook/config.ts`: ```js import { configure } from "@storybook/react"; configure( require.context("../src/stories", true, /\.stories\.(mdx|[tj]sx?)$/), module -
shilman revised this gist
Oct 19, 2019 . 1 changed file with 13 additions and 0 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -83,6 +83,19 @@ export const Button: FC<ButtonProps> = ({ children, onClick }) => ( Then update `./src/stories/1-Button.stories.tsx` to import this button instead of the `@storybook/react` demo button. You should see the props update and also the component documentation show up on the `Docs` tab. ## Step 6: Test MDX Finally, test that MDX is working. You already installed docs in Step 3, but now you need to tell Storybook to load `.stories.mdx` files by editing `.storybook/config.ts`: ```js configure( require.context("../src/stories", true, /\.stories\.(mdx|[tj]sx?)$/), module ); ``` ## Notes The `sourceLoaderOptions: null` in `Step 3` is covering up Storybook issue #7829: [Addon-docs: Typescript source support](https://github.com/storybookjs/storybook/issues/7829). I'll fix that issue ASAP to complete the walkthrough and update this gist when it's ready. -
shilman revised this gist
Oct 17, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -55,7 +55,7 @@ yarn storybook Then edit button caption in `./src/stories/1-Button.stories.tsx` and verify that the story updates in Storybook. Also verify that there's a `Docs` tab, and that it shows something reasonable-ish. We'll make it better in the next step. ## Step 5: Test Props -
shilman revised this gist
Oct 17, 2019 . No changes.There are no files selected for viewing
-
shilman revised this gist
Oct 17, 2019 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -53,7 +53,9 @@ module.exports = [ yarn storybook ``` Then edit button caption in `./src/stories/1-Button.stories.tsx` and verify that the story updates in Storybook. Also verify that there's a `Docs` tab, and that it shows something reasonable-ish. We'll make it better in the next st4ep. ## Step 5: Test Props -
shilman revised this gist
Oct 17, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -79,7 +79,7 @@ export const Button: FC<ButtonProps> = ({ children, onClick }) => ( ); ``` Then update `./src/stories/1-Button.stories.tsx` to import this button instead of the `@storybook/react` demo button. You should see the props update and also the component documentation show up on the `Docs` tab. ## Notes -
shilman revised this gist
Oct 17, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -79,7 +79,7 @@ export const Button: FC<ButtonProps> = ({ children, onClick }) => ( ); ``` Then update `./src/stories/1-Button.stories.tsx` to import this button instead of the `@storybook/react` demo button. You should see the props update and also the component documentation show up on the docs tab. ## Notes -
shilman revised this gist
Oct 17, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -83,4 +83,4 @@ Then update `./src/stories/1-Button.stories.tsx` to import this button instead o ## Notes The `sourceLoaderOptions: null` in `Step 3` is covering up Storybook issue #7829: [Addon-docs: Typescript source support](https://github.com/storybookjs/storybook/issues/7829). I'll fix that issue ASAP to complete the walkthrough and update this gist when it's ready. -
shilman revised this gist
Oct 17, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -83,4 +83,4 @@ Then update `./src/stories/1-Button.stories.tsx` to import this button instead o ## Notes The `sourceLoaderOptions: null` in `Step 3` is covering up Storybook issue #7829: [Addon-docs: Typescript source support](https://github.com/storybookjs/storybook/issues/7829) -
shilman revised this gist
Oct 17, 2019 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -79,6 +79,8 @@ export const Button: FC<ButtonProps> = ({ children, onClick }) => ( ); ``` Then update `./src/stories/1-Button.stories.tsx` to import this button instead of the `@storybook/react` demo button. ## Notes The `sourceLoaderOptions: null` in `Step 3` is covering up a -
shilman revised this gist
Oct 17, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -57,7 +57,7 @@ Then edit button caption in `./src/stories/1-Button.stories.tsx` and verify that ## Step 5: Test Props Storybook can't load docgen information from pre-built libraries, so to test that aspect out, create a file `./src/stories/Button.tsx`: ```tsx import React, { FC } from "react";
NewerOlder