diff --git a/code/frameworks/angular/template/cli/Button.stories.ts b/code/frameworks/angular/template/cli/Button.stories.ts index 1a4d6894f9a7..2af06574ce99 100644 --- a/code/frameworks/angular/template/cli/Button.stories.ts +++ b/code/frameworks/angular/template/cli/Button.stories.ts @@ -1,43 +1,52 @@ -import type { Meta, StoryFn } from '@storybook/angular'; +import type { Meta, StoryObj } from '@storybook/angular'; import Button from './button.component'; -// More on default export: https://storybook.js.org/docs/angular/writing-stories/introduction#default-export -export default { +// More on how to set up stories at: https://storybook.js.org/docs/angular/writing-stories/introduction#default-export +const meta: Meta`, + context: args, + }), // More on argTypes: https://storybook.js.org/docs/ember/api/argtypes argTypes: { label: { control: 'text' }, @@ -12,46 +16,46 @@ export default { }; // More on component templates: https://storybook.js.org/docs/ember/writing-stories/introduction#using-args -const Template = (args) => ({ - template: hbs``, - context: args, -}); - -export const Text = Template.bind({}); -// More on args: https://storybook.js.org/docs/ember/writing-stories/args -Text.args = { - label: 'Button', - onClick: action('onClick'), +export const Text = { + args: { + label: 'Button', + onClick: action('onClick'), + }, }; -export const Emoji = Template.bind({}); -Emoji.args = { - label: '😀 😎 👍 💯', +export const Emoji = { + args: { + label: '😀 😎 👍 💯', + }, }; -export const TextWithAction = () => ({ - template: hbs` +export const TextWithAction = { + render: () => ({ + template: hbs` `, - context: { - onClick: () => action('This was clicked')(), + context: { + onClick: () => action('This was clicked')(), + }, + }), + name: 'With an action', + parameters: { + notes: 'My notes on a button with emojis', }, -}); - -TextWithAction.storyName = 'With an action'; -TextWithAction.parameters = { notes: 'My notes on a button with emojis' }; +}; -export const ButtonWithLinkToAnotherStory = () => ({ - template: hbs` +export const ButtonWithLinkToAnotherStory = { + render: () => ({ + template: hbs` `, - context: { - onClick: linkTo('example-introduction--page'), - }, -}); - -ButtonWithLinkToAnotherStory.storyName = 'button with link to another story'; + context: { + onClick: linkTo('example-introduction--page'), + }, + }), + name: 'button with link to another story', +}; diff --git a/code/frameworks/nextjs/template/cli/ts/Button.stories.ts b/code/frameworks/nextjs/template/cli/ts/Button.stories.ts new file mode 100644 index 000000000000..07a7b51921a9 --- /dev/null +++ b/code/frameworks/nextjs/template/cli/ts/Button.stories.ts @@ -0,0 +1,46 @@ +import type { Meta, StoryObj } from '@storybook/react'; + +import { Button } from './Button'; + +// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export +const meta: Meta = { + title: 'Example/Button', + component: Button, + // More on argTypes: https://storybook.js.org/docs/react/api/argtypes + argTypes: { + backgroundColor: { + control: 'color', + }, + }, +}; + +export default meta; +type Story = StoryObj; + +// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args +export const Primary: Story = { + args: { + primary: true, + label: 'Button', + }, +}; + +export const Secondary: Story = { + args: { + label: 'Button', + }, +}; + +export const Large: Story = { + args: { + size: 'large', + label: 'Button', + }, +}; + +export const Small: Story = { + args: { + size: 'small', + label: 'Button', + }, +}; diff --git a/code/frameworks/nextjs/template/cli/ts/Button.stories.tsx b/code/frameworks/nextjs/template/cli/ts/Button.stories.tsx deleted file mode 100644 index 1b371df29f48..000000000000 --- a/code/frameworks/nextjs/template/cli/ts/Button.stories.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import * as React from 'react'; -import type { ComponentStoryFn, ComponentMeta } from '@storybook/react'; - -import { Button } from './Button'; - -// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export -export default { - title: 'Example/Button', - component: Button, - // More on argTypes: https://storybook.js.org/docs/react/api/argtypes - argTypes: { - backgroundColor: { control: 'color' }, - }, -} as ComponentMeta; - -// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args -const Template: ComponentStoryFn = (args) =>