Files
ComfyUI_frontend/src/components/ui/button/Button.stories.ts
Alexander Brown 8d7dd9ed67 Component: Button migration 1: TextButton (#7537)
## Summary

Setup the variants and migrate existing uses of
TextButton/TextIconButton/IconButton to a single Button component.

Still a work in progress.

## Changes

- **What**: Add a new Button
- **What**: Migrate old buttons
- **What**: Delete old buttons
- **Dependencies**: CVA, upgrade Storybook

## Review Focus

<!-- Critical design decisions or edge cases that need attention -->

<!-- If this PR fixes an issue, uncomment and update the line below -->
<!-- Fixes #ISSUE_NUMBER -->

## Screenshots (if applicable)

<!-- Add screenshots or video recording to help explain your changes -->

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-7537-WIP-Component-Button-migration-2cb6d73d36508156a81bfc7bbddb36e9)
by [Unito](https://www.unito.io)

---------

Co-authored-by: GitHub Action <action@github.com>
2025-12-16 20:38:24 -08:00

69 lines
1.5 KiB
TypeScript

import type { Meta, StoryObj } from '@storybook/vue3-vite'
import Button from './Button.vue'
import { FOR_STORIES } from '@/components/ui/button/button.variants'
const { variants, sizes } = FOR_STORIES
const meta: Meta<typeof Button> = {
title: 'Components/Button/Button',
component: Button,
tags: ['autodocs'],
argTypes: {
size: {
control: { type: 'select' },
options: sizes,
defaultValue: 'md'
},
variant: {
control: { type: 'select' },
options: variants,
defaultValue: 'primary'
},
as: { defaultValue: 'button' },
asChild: { defaultValue: false },
default: {
defaultValue: 'Button'
}
},
args: {
variant: 'secondary',
size: 'md',
default: 'Button'
}
}
export default meta
type Story = StoryObj<typeof meta>
export const SingleButton: Story = {
args: {
variant: 'primary',
size: 'lg'
}
}
function generateVariants() {
const variantButtons: string[] = []
for (const variant of variants) {
for (const size of sizes) {
variantButtons.push(
`<Button variant="${variant}" size="${size}">${size === 'icon' ? `<i class="icon-[lucide--settings]" />` : variant}</Button>`
)
}
}
return variantButtons
}
// Note: Keep the number of columns here aligned with the number of sizes above.
export const AllVariants: Story = {
render: () => ({
components: { Button },
template: `
<div class="grid grid-cols-4 gap-4 place-items-center-safe">
${generateVariants().join('\n')}
</div>
`
})
}