diff --git a/lib/cli/src/frameworks/angular/1-Button.stories.ts b/lib/cli/src/frameworks/angular/1-Button.stories.ts index e82ad1c3156..dd7d383b23c 100644 --- a/lib/cli/src/frameworks/angular/1-Button.stories.ts +++ b/lib/cli/src/frameworks/angular/1-Button.stories.ts @@ -8,19 +8,21 @@ export default { component: Button, }; -export const Text = () => ({ +const ButtonStory = (args: Button) => ({ component: Button, - props: { - text: 'Hello Button', - }, + props: args, }); -export const Emoji = () => ({ - component: Button, - props: { - text: '😀 😎 👍 💯', - }, -}); +export const Text = ButtonStory.bind({}); +Text.args = { + children: 'Button', + onClick: action('onClick'), +}; + +export const Emoji = ButtonStory.bind({}); +Emoji.args = { + children: '😀 😎 👍 💯', +}; Emoji.parameters = { notes: 'My notes on a button with emojis' }; diff --git a/lib/cli/src/frameworks/aurelia/1-Button.stories.ts b/lib/cli/src/frameworks/aurelia/1-Button.stories.ts index 25989973d3a..d7b9b6feb4e 100644 --- a/lib/cli/src/frameworks/aurelia/1-Button.stories.ts +++ b/lib/cli/src/frameworks/aurelia/1-Button.stories.ts @@ -6,23 +6,26 @@ import Button from './button'; export default { title: 'Button', component: Button, + argTypes: { + text: { control: 'text' }, + }, }; -export const Text = () => ({ +const ButtonStory = (args) => ({ component: Button, - props: { - text: 'Hello Button', - }, + props: args, }); -export const Emoji = () => ({ - component: Button, - props: { - text: '😀 😎 👍 💯', - }, -}); +export const Text = ButtonStory.bind({}); +Text.args = { + children: 'Button', + onClick: action('onClick'), +}; -Emoji.parameters = { notes: 'My notes on a button with emojis' }; +export const Emoji = ButtonStory.bind({}); +Emoji.args = { + children: '😀 😎 👍 💯', +}; export const TextWithAction = () => ({ component: Button, diff --git a/lib/cli/src/frameworks/ember/1-Button.stories.js b/lib/cli/src/frameworks/ember/1-Button.stories.js index 98e1959eb66..a253da3b1e5 100644 --- a/lib/cli/src/frameworks/ember/1-Button.stories.js +++ b/lib/cli/src/frameworks/ember/1-Button.stories.js @@ -4,29 +4,26 @@ import { linkTo } from '@storybook/addon-links'; export default { title: 'Button', + argTypes: { + children: { control: 'text' }, + }, }; -export const Text = () => ({ - template: hbs``, - context: { - onClick: action('clicked'), - }, +const ButtonStory = (args) => ({ + template: hbs``, + context: args, }); -export const Emoji = () => ({ - template: hbs` - - `, - context: { - onClick: action('clicked'), - }, -}); +export const Text = ButtonStory.bind({}); +Text.args = { + children: 'Button', + onClick: action('onClick'), +}; -Emoji.parameters = { notes: 'My notes on a button with emojis' }; +export const Emoji = ButtonStory.bind({}); +Emoji.args = { + children: '😀 😎 👍 💯', +}; export const TextWithAction = () => ({ template: hbs` diff --git a/lib/cli/src/frameworks/html/1-Button.stories.js b/lib/cli/src/frameworks/html/1-Button.stories.js index 63342a3f2cc..7244dca963d 100644 --- a/lib/cli/src/frameworks/html/1-Button.stories.js +++ b/lib/cli/src/frameworks/html/1-Button.stories.js @@ -3,25 +3,29 @@ import { linkTo } from '@storybook/addon-links'; export default { title: 'Button', + argTypes: { + children: { control: 'text' }, + }, }; -export const Text = () => { +const ButtonStory = ({ onClick, children }) => { const btn = document.createElement('button'); btn.type = 'button'; - btn.innerText = 'Hello Button'; - btn.addEventListener('click', action('clicked')); + btn.innerText = children; + btn.addEventListener('click', onClick); return btn; }; -export const Emoji = () => { - const btn = document.createElement('button'); - btn.type = 'button'; - btn.innerText = '😀 😎 👍 💯'; - btn.addEventListener('click', action('clicked')); - return btn; +export const Text = ButtonStory.bind({}); +Text.args = { + children: 'Button', + onClick: action('onClick'), }; -Emoji.parameters = { notes: 'My notes on a button with emojis' }; +export const Emoji = ButtonStory.bind({}); +Emoji.args = { + children: '😀 😎 👍 💯', +}; export const TextWithAction = () => { const btn = document.createElement('button'); diff --git a/lib/cli/src/frameworks/mithril/1-Button.stories.js b/lib/cli/src/frameworks/mithril/1-Button.stories.js index ac84800bc03..642dc37f8ef 100644 --- a/lib/cli/src/frameworks/mithril/1-Button.stories.js +++ b/lib/cli/src/frameworks/mithril/1-Button.stories.js @@ -6,22 +6,25 @@ import Button from './Button'; export default { title: 'Button', component: Button, + argTypes: { + children: { control: 'text' }, + }, }; -export const Text = () => ({ - view: () => m(Button, { onclick: action('clicked') }, 'Hello Button'), +const ButtonStory = ({ children, ...args }) => ({ + view: () => m(Button, args, children), }); -export const Emoji = () => ({ - view: () => - m( - Button, - { onclick: action('clicked') }, - m('span', { role: 'img', ariaLabel: 'so cool' }, '😀 😎 👍 💯') - ), -}); +export const Text = ButtonStory.bind({}); +Text.args = { + children: 'Button', + onClick: action('onClick'), +}; -Emoji.parameters = { notes: 'My notes on a button with emojis' }; +export const Emoji = ButtonStory.bind({}); +Emoji.args = { + children: '😀 😎 👍 💯', +}; export const TextWithAction = () => ({ view: () => m(Button, { onclick: () => action('This was clicked')() }, 'Trigger Action'), diff --git a/lib/cli/src/frameworks/preact/1-Button.stories.js b/lib/cli/src/frameworks/preact/1-Button.stories.js index 0c4397ea036..b5c376d2a9e 100644 --- a/lib/cli/src/frameworks/preact/1-Button.stories.js +++ b/lib/cli/src/frameworks/preact/1-Button.stories.js @@ -8,19 +8,23 @@ import Button from './Button'; export default { title: 'Button', component: Button, + argTypes: { + children: { control: 'text' }, + }, }; -export const Text = () => ; +const ButtonStory = (args) => -); +export const Text = ButtonStory.bind({}); +Text.args = { + children: 'Button', + onClick: action('onClick'), +}; -Emoji.parameters = { notes: 'My notes on a button with emojis' }; +export const Emoji = ButtonStory.bind({}); +Emoji.args = { + children: '😀 😎 👍 💯', +}; export const TextWithAction = () => ( diff --git a/lib/cli/src/frameworks/rax/1-Button.stories.js b/lib/cli/src/frameworks/rax/1-Button.stories.js index 7cdc117ed61..ebf850f6b00 100644 --- a/lib/cli/src/frameworks/rax/1-Button.stories.js +++ b/lib/cli/src/frameworks/rax/1-Button.stories.js @@ -2,31 +2,35 @@ import { createElement } from 'rax'; import { action } from '@storybook/addon-actions'; import { linkTo } from '@storybook/addon-links'; -import Text from 'rax-text'; +import RaxText from 'rax-text'; export default { title: 'Button', + argTypes: { + children: { control: 'text' }, + }, }; -export const text = () => ( - ); -export const Emoji = () => ( - -); +export const Text = ButtonStory.bind({}); +Text.args = { + children: 'Button', + onClick: action('onClick'), +}; -Emoji.parameters = { notes: 'My notes on a button with emojis' }; +export const Emoji = ButtonStory.bind({}); +Emoji.args = { + children: '😀 😎 👍 💯', +}; export const TextWithAction = () => ( ); @@ -35,7 +39,7 @@ TextWithAction.parameters = { notes: 'My notes on a button with emojis' }; export const ButtonWithLinkToAnotherStory = () => ( ); diff --git a/lib/cli/src/frameworks/react/js/1-Button.stories.js b/lib/cli/src/frameworks/react/js/1-Button.stories.js index 32a9e4aa3a7..aee11b94a2d 100644 --- a/lib/cli/src/frameworks/react/js/1-Button.stories.js +++ b/lib/cli/src/frameworks/react/js/1-Button.stories.js @@ -6,6 +6,9 @@ import { Button } from './Button'; export default { title: 'Button', component: Button, + argTypes: { + children: { control: 'text' }, + }, }; const ButtonStory = (args) => `; -export const Emoji = () => html` - -`; +export const Text = ButtonStory.bind({}); +Text.args = { + children: 'Button', + onClick: action('onClick'), +}; -Emoji.parameters = { notes: 'My notes on a button with emojis' }; +export const Emoji = ButtonStory.bind({}); +Emoji.args = { + children: '😀 😎 👍 💯', +}; export const TextWithAction = () => html`