|
1 | | -import type { Meta, StoryObj } from "@storybook/svelte"; |
2 | | -import ButtonAction from "./ButtonAction.svelte"; |
3 | | -import { ButtonText } from "./ButtonSnippets.svelte"; |
4 | | - |
5 | | -const meta: Meta<ButtonAction> = { |
6 | | - title: "Components/ButtonAction", |
7 | | - component: ButtonAction, |
8 | | - args: { |
9 | | - variant: "solid", |
10 | | - isLoading: false, |
11 | | - blockingClick: false, |
12 | | - children: "Click Me", // Ensure this is a function returning text |
13 | | - }, |
14 | | - argTypes: { |
15 | | - variant: { |
16 | | - control: { |
17 | | - type: "select", |
18 | | - options: ["solid", "soft", "danger", "danger-soft", "white"], |
19 | | - }, |
20 | | - }, |
21 | | - size: { |
22 | | - control: { |
23 | | - type: "select", |
24 | | - options: ["sm", "md"], |
25 | | - }, |
26 | | - }, |
27 | | - isLoading: { control: "boolean" }, |
28 | | - blockingClick: { control: "boolean" }, |
29 | | - callback: { action: "clicked" }, |
30 | | - }, |
31 | | -}; |
32 | | - |
33 | | -export default meta; |
34 | | -type Story = StoryObj<typeof meta>; |
35 | | - |
36 | | -export const Solid: Story = { |
37 | | - args: { variant: "solid", children: ButtonText }, |
38 | | -}; |
39 | | - |
40 | | -export const Soft: Story = { |
41 | | - args: { variant: "soft", children: ButtonText }, |
42 | | -}; |
43 | | - |
44 | | -export const Danger: Story = { |
45 | | - args: { variant: "danger", children: ButtonText }, |
46 | | -}; |
47 | | - |
48 | | -export const DangerSoft: Story = { |
49 | | - args: { variant: "danger-soft", children: ButtonText }, |
50 | | -}; |
51 | | - |
52 | | -export const Loading: Story = { |
53 | | - args: { isLoading: true, children: ButtonText }, |
54 | | -}; |
55 | | - |
56 | | -export const BlockingClick: Story = { |
57 | | - args: { |
58 | | - blockingClick: true, |
59 | | - children: ButtonText, |
60 | | - callback: async () => { |
61 | | - await new Promise((resolve) => setTimeout(resolve, 2000)); |
62 | | - }, |
63 | | - }, |
64 | | -}; |
| 1 | +import type { Meta, StoryObj } from '@storybook/svelte' |
| 2 | +import ButtonAction from './ButtonAction.svelte' |
| 3 | +import { ButtonText } from './ButtonSnippets.svelte' |
| 4 | + |
| 5 | +export default { |
| 6 | + title: 'UI/ButtonAction', |
| 7 | + component: ButtonAction, |
| 8 | + args: { |
| 9 | + variant: 'solid', |
| 10 | + isLoading: false, |
| 11 | + blockingClick: false, |
| 12 | + children: 'Click Me', |
| 13 | + }, |
| 14 | + argTypes: { |
| 15 | + variant: { |
| 16 | + control: { |
| 17 | + type: 'select', |
| 18 | + options: ['solid', 'soft', 'danger', 'danger-soft', 'white'], |
| 19 | + }, |
| 20 | + }, |
| 21 | + size: { |
| 22 | + control: { |
| 23 | + type: 'select', |
| 24 | + options: ['sm', 'md'], |
| 25 | + }, |
| 26 | + }, |
| 27 | + isLoading: { control: 'boolean' }, |
| 28 | + blockingClick: { control: 'boolean' }, |
| 29 | + callback: { action: 'clicked' }, |
| 30 | + }, |
| 31 | +} |
| 32 | + |
| 33 | +export const Solid = { |
| 34 | + args: { variant: 'solid', children: ButtonText }, |
| 35 | +} |
| 36 | + |
| 37 | +export const Soft = { |
| 38 | + args: { variant: 'soft', children: ButtonText }, |
| 39 | +} |
| 40 | + |
| 41 | +export const Danger = { |
| 42 | + args: { variant: 'danger', children: ButtonText }, |
| 43 | +} |
| 44 | + |
| 45 | +export const DangerSoft = { |
| 46 | + args: { variant: 'danger-soft', children: ButtonText }, |
| 47 | +} |
| 48 | + |
| 49 | +export const Loading = { |
| 50 | + args: { isLoading: true, children: ButtonText }, |
| 51 | +} |
| 52 | + |
| 53 | +export const BlockingClick = { |
| 54 | + args: { |
| 55 | + blockingClick: true, |
| 56 | + children: ButtonText, |
| 57 | + callback: async () => { |
| 58 | + await new Promise((resolve) => setTimeout(resolve, 2000)) |
| 59 | + }, |
| 60 | + }, |
| 61 | +} |
0 commit comments