From 9346bae04e2cfaedcc857f9876c51cf846633772 Mon Sep 17 00:00:00 2001 From: Michael Shilman <michael@lab80.co> Date: Mon, 18 May 2020 11:40:50 +0800 Subject: [PATCH] Clean up `react-ts` example and addon-essentials for testing --- examples/react-ts/main.js | 2 ++ examples/react-ts/package.json | 1 + examples/react-ts/src/button.stories.tsx | 6 ++++-- examples/react-ts/src/button.tsx | 3 +++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/examples/react-ts/main.js b/examples/react-ts/main.js index 752ddf1f25e9..c1e1e15290eb 100644 --- a/examples/react-ts/main.js +++ b/examples/react-ts/main.js @@ -1,7 +1,9 @@ module.exports = { stories: ['./src/*.stories.*'], + addons: ['@storybook/addon-essentials'], typescript: { check: true, checkOptions: {}, + docgen: 'react-docgen', }, }; diff --git a/examples/react-ts/package.json b/examples/react-ts/package.json index ee22103c642f..c5c9f2a57822 100644 --- a/examples/react-ts/package.json +++ b/examples/react-ts/package.json @@ -8,6 +8,7 @@ "storybook": "cross-env STORYBOOK_DISPLAY_WARNING=true DISPLAY_WARNING=true start-storybook -p 9011 -c ./ --no-dll" }, "dependencies": { + "@storybook/addon-essentials": "6.0.0-beta.7", "@storybook/react": "6.0.0-beta.7", "@types/react": "^16.9.35", "@types/react-dom": "^16.9.8", diff --git a/examples/react-ts/src/button.stories.tsx b/examples/react-ts/src/button.stories.tsx index 41ea8e4e19c0..b2350a28722f 100644 --- a/examples/react-ts/src/button.stories.tsx +++ b/examples/react-ts/src/button.stories.tsx @@ -1,6 +1,8 @@ import React from 'react'; +import { argsStory } from '@storybook/react'; import { Button } from './button'; -export default { component: Button, title: 'Examples / Button' }; +export default { component: Button, title: 'Examples/Button' }; -export const SimpleButton = () => <Button label="Click me" />; +export const WithArgs = argsStory({ label: 'With args' }); +export const Basic = () => <Button label="Click me" />; diff --git a/examples/react-ts/src/button.tsx b/examples/react-ts/src/button.tsx index 9f2285349f2f..3115bbcbf2c9 100644 --- a/examples/react-ts/src/button.tsx +++ b/examples/react-ts/src/button.tsx @@ -1,6 +1,9 @@ import React, { FC, ButtonHTMLAttributes } from 'react'; export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> { + /** + * A label to show on the button + */ label: string; }