Skip to content

Commit

Permalink
add mockFn and descriptions to button example
Browse files Browse the repository at this point in the history
  • Loading branch information
JReinhold committed Jun 20, 2024
1 parent 20d6a39 commit 799eb49
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions examples/Button.stories.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
type Args,
type StoryContext,
} from '@storybook/addon-svelte-csf';
import { fn } from '@storybook/test';
import Button from './components/Button.svelte';
const onclickFn = fn().mockName('onclick');
/**
* These are the stories for the `Button` component.
* It's the default button we use throughout our application.
Expand All @@ -17,6 +20,7 @@
tags: ['autodocs'],
args: {
children: 'Click me',
onclick: onclickFn,
},
argTypes: {
backgroundColor: { control: 'color' },
Expand All @@ -37,15 +41,16 @@
<Button {...args}>{children}</Button>
{/snippet}

<!-- More on writing stories with args: https://storybook.js.org/docs/writing-stories/args -->
<!-- Only use this sparingly as the main CTA. -->
<Story name="Primary" args={{ primary: true }} />

<Story name="Secondary" />

<Story name="Large" args={{ size: 'large' }} />

<!-- This is _tiny_ 🤏 -->
<Story name="Small" args={{ size: 'small' }} />

<Story name="Long content">
<Button>The content</Button>
<Button onclick={onclickFn}>The very long content</Button>
</Story>

0 comments on commit 799eb49

Please sign in to comment.