import { Meta, moduleMetadata, StoryObj } from "@storybook/angular"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { formatArgsForCodeSnippet } from "../../../../.storybook/format-args-for-code-snippet"; import { I18nMockService } from "../utils/i18n-mock.service"; import { ButtonComponent } from "./button.component"; export default { title: "Component Library/Button", component: ButtonComponent, decorators: [ moduleMetadata({ providers: [ { provide: I18nService, useFactory: () => new I18nMockService({ loading: "Loading", }), }, ], }), ], args: { disabled: false, loading: false, }, argTypes: { size: { options: ["small", "default"], control: { type: "radio" }, }, }, parameters: { design: { type: "figma", url: "https://www.figma.com/design/Zt3YSeb6E6lebAffrNLa0h/Tailwind-Component-Library?node-id=16329-28224&t=b5tDKylm5sWm2yKo-4", }, }, } as Meta; type Story = StoryObj; export const Default: Story = { render: (args) => ({ props: args, template: /*html*/ ` `, }), args: { buttonType: "secondary", }, }; export const Primary: Story = { ...Default, args: { buttonType: "primary", }, }; export const DangerPrimary: Story = { ...Default, args: { buttonType: "dangerPrimary", }, }; export const Danger: Story = { ...Default, args: { buttonType: "danger", }, }; export const Small: Story = { render: (args) => ({ props: args, template: /*html*/ `
`, }), args: { size: "small", }, }; export const Loading: Story = { ...Default, args: { loading: true, }, }; export const Disabled: Story = { ...Loading, args: { disabled: true, }, }; export const DisabledWithAttribute: Story = { render: (args) => ({ props: args, template: /*html*/ ` @if (disabled) { } @else { } `, }), args: { disabled: true, loading: false, }, }; export const Block: Story = { render: (args) => ({ props: args, template: /*html*/ ` [block]="true" Link block Link `, }), args: { block: true, }, }; export const WithIcon: Story = { render: (args) => ({ props: args, template: /*html*/ `
`, }), }; export const InteractionStates: Story = { render: (args) => ({ props: args, template: /*html*/ `
`, }), args: { buttonType: "primary", }, };