import type { Meta, StoryObj } from '@storybook/vue3-vite' import { ref } from 'vue' import { Button as NychButton } from '@nychthemeron/library' const meta = { title: 'Components/Button', component: NychButton, parameters: { layout: 'centered', }, tags: ['autodocs'], argTypes: { variant: { control: { type: 'select' }, options: ['primary', 'secondary', 'info', 'success', 'warning', 'danger'], description: 'Button color variant', }, size: { control: { type: 'select' }, options: ['default', 'sm', 'lg', 'icon'], description: 'Button size', }, disabled: { control: { type: 'boolean' }, description: 'Disable the button', }, loading: { control: { type: 'boolean' }, description: 'Show loading state', }, }, } satisfies Meta export default meta type Story = StoryObj export const Primary: Story = { args: { variant: 'primary' }, render: (args) => ({ components: { NychButton }, setup: () => ({ args }), template: `Summon the Oracle`, }), } export const AllVariants: Story = { render: () => ({ components: { NychButton }, template: `
Primary Secondary Info Success Warning Danger
`, }), } export const Sizes: Story = { render: () => ({ components: { NychButton }, template: `
Small Default Large
`, }), } export const Disabled: Story = { args: { disabled: true }, render: (args) => ({ components: { NychButton }, setup: () => ({ args }), template: `Disabled`, }), } export const Loading: Story = { args: { loading: true }, render: (args) => ({ components: { NychButton }, setup: () => ({ args }), template: `Ask`, }), } export const Interactive: Story = { render: () => ({ components: { NychButton }, setup() { const clickCount = ref(0) const isLoading = ref(false) const handleClick = () => { clickCount.value++ isLoading.value = true setTimeout(() => { isLoading.value = false }, 1000) } return { clickCount, isLoading, handleClick } }, template: `
Click Me

Clicks: {{ clickCount }}

`, }), }