Skip to content

Commit

Permalink
Add explicit actions to CLI header story
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperpeulen committed Mar 6, 2024
1 parent 1fac5e1 commit dbef8b5
Show file tree
Hide file tree
Showing 21 changed files with 106 additions and 23 deletions.
6 changes: 6 additions & 0 deletions code/frameworks/angular/template/cli/header.stories.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Meta, StoryObj } from '@storybook/angular';

import { HeaderComponent } from './header.component';
import { fn } from '@storybook/test';

const meta: Meta<HeaderComponent> = {
title: 'Example/Header',
Expand All @@ -11,6 +12,11 @@ const meta: Meta<HeaderComponent> = {
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
layout: 'fullscreen',
},
args: {
onLogin: fn(),
onLogout: fn(),
onCreateAccount: fn(),
},
};

export default meta;
Expand Down
4 changes: 2 additions & 2 deletions code/frameworks/ember/template/cli/Button.stories.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { hbs } from 'ember-cli-htmlbars';
import { action } from '@storybook/addon-actions';
import { linkTo } from '@storybook/addon-links';
import { fn } from '@storybook/test';

// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
export default {
Expand All @@ -14,20 +15,19 @@ export default {
},
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/ember/writing-docs/autodocs
tags: ['autodocs'],
args: { onClick: fn() },
};

// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
export const Text = {
args: {
label: 'Button',
onClick: action('onClick'),
},
};

export const Emoji = {
args: {
label: '😀 😎 👍 💯',
onClick: action('onClick'),
},
};

Expand Down
6 changes: 6 additions & 0 deletions code/frameworks/nextjs/template/cli/js/Header.stories.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { fn } from '@storybook/test';
import { Header } from './Header';

export default {
Expand All @@ -9,6 +10,11 @@ export default {
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
layout: 'fullscreen',
},
args: {
onLogin: fn(),
onLogout: fn(),
onCreateAccount: fn(),
},
};
export const LoggedIn = {
args: {
Expand Down
7 changes: 7 additions & 0 deletions code/frameworks/nextjs/template/cli/ts-3-8/Header.stories.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import type { Meta, StoryObj } from '@storybook/react';
import { fn } from '@storybook/test';

import { Header } from './Header';

const meta: Meta<typeof Header> = {
Expand All @@ -10,6 +12,11 @@ const meta: Meta<typeof Header> = {
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
layout: 'fullscreen',
},
args: {
onLogin: fn(),
onLogout: fn(),
onCreateAccount: fn(),
},
};

export default meta;
Expand Down
6 changes: 6 additions & 0 deletions code/frameworks/nextjs/template/cli/ts-4-9/Header.stories.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Meta, StoryObj } from '@storybook/react';
import { fn } from '@storybook/test';
import { Header } from './Header';

const meta = {
Expand All @@ -10,6 +11,11 @@ const meta = {
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
layout: 'fullscreen',
},
args: {
onLogin: fn(),
onLogout: fn(),
onCreateAccount: fn(),
},
} satisfies Meta<typeof Header>;

export default meta;
Expand Down
10 changes: 5 additions & 5 deletions code/renderers/html/template/cli/js/Header.stories.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { fn } from '@storybook/test';
import { createHeader } from './Header';

export default {
Expand All @@ -9,11 +10,10 @@ export default {
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
layout: 'fullscreen',
},
// More on argTypes: https://storybook.js.org/docs/api/argtypes
argTypes: {
onLogin: { action: 'onLogin' },
onLogout: { action: 'onLogout' },
onCreateAccount: { action: 'onCreateAccount' },
args: {
onLogin: fn(),
onLogout: fn(),
onCreateAccount: fn(),
},
};

Expand Down
9 changes: 5 additions & 4 deletions code/renderers/html/template/cli/ts-3-8/Header.stories.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Meta, StoryObj } from '@storybook/html';
import { fn } from '@storybook/test';
import type { HeaderProps } from './Header';
import { createHeader } from './Header';

Expand All @@ -12,10 +13,10 @@ const meta: Meta<HeaderProps> = {
layout: 'fullscreen',
},
// More on argTypes: https://storybook.js.org/docs/api/argtypes
argTypes: {
onLogin: { action: 'onLogin' },
onLogout: { action: 'onLogout' },
onCreateAccount: { action: 'onCreateAccount' },
args: {
onLogin: fn(),
onLogout: fn(),
onCreateAccount: fn(),
},
};

Expand Down
9 changes: 5 additions & 4 deletions code/renderers/html/template/cli/ts-4-9/Header.stories.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Meta, StoryObj } from '@storybook/html';
import { fn } from '@storybook/test';
import type { HeaderProps } from './Header';
import { createHeader } from './Header';

Expand All @@ -12,10 +13,10 @@ const meta = {
layout: 'fullscreen',
},
// More on argTypes: https://storybook.js.org/docs/api/argtypes
argTypes: {
onLogin: { action: 'onLogin' },
onLogout: { action: 'onLogout' },
onCreateAccount: { action: 'onCreateAccount' },
args: {
onLogin: fn(),
onLogout: fn(),
onCreateAccount: fn(),
},
} satisfies Meta<HeaderProps>;

Expand Down
8 changes: 4 additions & 4 deletions code/renderers/preact/template/cli/Header.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ export default {
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
layout: 'fullscreen',
},
argTypes: {
onLogin: { action: 'onLogin' },
onLogout: { action: 'onLogout' },
onCreateAccount: { action: 'onCreateAccount' },
args: {
onLogin: fn(),
onLogout: fn(),
onCreateAccount: fn(),
},
};

Expand Down
6 changes: 6 additions & 0 deletions code/renderers/react/template/cli/js/Header.stories.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Header } from './Header';
import { fn } from '@storybook/test';

export default {
title: 'Example/Header',
Expand All @@ -9,6 +10,11 @@ export default {
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
layout: 'fullscreen',
},
args: {
onLogin: fn(),
onLogout: fn(),
onCreateAccount: fn(),
},
};

export const LoggedIn = {
Expand Down
6 changes: 6 additions & 0 deletions code/renderers/react/template/cli/ts-3-8/Header.stories.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Meta, StoryObj } from '@storybook/react';
import { fn } from '@storybook/test';

import { Header } from './Header';

Expand All @@ -11,6 +12,11 @@ const meta: Meta<typeof Header> = {
// More on Story layout: https://storybook.js.org/docs/configure/story-layout
layout: 'fullscreen',
},
args: {
onLogin: fn(),
onLogout: fn(),
onCreateAccount: fn(),
},
};

export default meta;
Expand Down
6 changes: 6 additions & 0 deletions code/renderers/react/template/cli/ts-4-9/Header.stories.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Meta, StoryObj } from '@storybook/react';
import { fn } from '@storybook/test';

import { Header } from './Header';

Expand All @@ -11,6 +12,11 @@ const meta = {
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
layout: 'fullscreen',
},
args: {
onLogin: fn(),
onLogout: fn(),
onCreateAccount: fn(),
},
} satisfies Meta<typeof Header>;

export default meta;
Expand Down
6 changes: 6 additions & 0 deletions code/renderers/vue3/template/cli/js/Header.stories.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { fn } from '@storybook/test';
import MyHeader from './Header.vue';

export default {
Expand All @@ -24,6 +25,11 @@ export default {
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
layout: 'fullscreen',
},
args: {
onLogin: fn(),
onLogout: fn(),
onCreateAccount: fn(),
},
};

export const LoggedIn = {
Expand Down
6 changes: 6 additions & 0 deletions code/renderers/vue3/template/cli/ts-3-8/Header.stories.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { fn } from '@storybook/test';
import type { Meta, StoryObj } from '@storybook/vue3';

import MyHeader from './Header.vue';
Expand All @@ -21,6 +22,11 @@ const meta: Meta<typeof MyHeader> = {
layout: 'fullscreen',
},
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/writing-docs/autodocs
args: {
onLogin: fn(),
onLogout: fn(),
onCreateAccount: fn(),
},
tags: ['autodocs'],
};

Expand Down
6 changes: 6 additions & 0 deletions code/renderers/vue3/template/cli/ts-4-9/Header.stories.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Meta, StoryObj } from '@storybook/vue3';
import { fn } from '@storybook/test';

import MyHeader from './Header.vue';

Expand All @@ -20,6 +21,11 @@ const meta = {
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
layout: 'fullscreen',
},
args: {
onLogin: fn(),
onLogout: fn(),
onCreateAccount: fn(),
},
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/writing-docs/autodocs
tags: ['autodocs'],
} satisfies Meta<typeof MyHeader>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { fn } from '@storybook/test';
import { Button } from './Button';

// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
Expand All @@ -7,12 +8,12 @@ export default {
render: (args) => Button(args),
argTypes: {
backgroundColor: { control: 'color' },
onClick: { action: 'onClick' },
size: {
control: { type: 'select' },
options: ['small', 'medium', 'large'],
},
},
args: { onClick: fn() },
};

// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import { fn } from '@storybook/test';
import { Header } from './Header';

export default {
title: 'Example/Header',
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/web-components/vue/writing-docs/autodocs
tags: ['autodocs'],
render: (args) => Header(args),
args: {
onLogin: fn(),
onLogout: fn(),
onCreateAccount: fn(),
},
};

export const LoggedIn = {
args: {
user: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Meta, StoryObj } from '@storybook/web-components';
import { fn } from '@storybook/test';
import type { ButtonProps } from './Button';
import { Button } from './Button';

Expand All @@ -9,12 +10,12 @@ const meta: Meta<ButtonProps> = {
render: (args) => Button(args),
argTypes: {
backgroundColor: { control: 'color' },
onClick: { action: 'onClick' },
size: {
control: { type: 'select' },
options: ['small', 'medium', 'large'],
},
},
args: { onClick: fn() },
};

export default meta;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Meta, StoryObj } from '@storybook/web-components';
import { fn } from '@storybook/test';
import type { HeaderProps } from './Header';
import { Header } from './Header';

Expand All @@ -7,6 +8,11 @@ const meta: Meta<HeaderProps> = {
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
tags: ['autodocs'],
render: (args: HeaderProps) => Header(args),
args: {
onLogin: fn(),
onLogout: fn(),
onCreateAccount: fn(),
},
};

export default meta;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Meta, StoryObj } from '@storybook/web-components';
import { fn } from '@storybook/test';
import type { ButtonProps } from './Button';
import { Button } from './Button';

Expand All @@ -9,12 +10,12 @@ const meta = {
render: (args) => Button(args),
argTypes: {
backgroundColor: { control: 'color' },
onClick: { action: 'onClick' },
size: {
control: { type: 'select' },
options: ['small', 'medium', 'large'],
},
},
args: { onClick: fn() },
} satisfies Meta<ButtonProps>;

export default meta;
Expand Down
Loading

0 comments on commit dbef8b5

Please sign in to comment.