Skip to content
Snippets Groups Projects
button.stories.ts 1.19 KiB
Newer Older
  • Learn to ignore specific revisions
  • import { argsToTemplate, moduleMetadata, type Meta, type StoryObj } from '@storybook/angular';
    
    import { FileIconComponent } from '../icons/file-icon/file-icon.component';
    
    import { ButtonComponent } from './button.component';
    
    const meta: Meta<ButtonComponent> = {
      title: 'Button',
      component: ButtonComponent,
    
          imports: [ButtonComponent, FileIconComponent],
    
      excludeStories: /.*Data$/,
      tags: ['autodocs'],
    };
    
    export default meta;
    type Story = StoryObj<ButtonComponent>;
    
    export const Default: Story = {
    
    OZGCloud's avatar
    OZGCloud committed
      args: {
        text: 'Hello world!',
        isLoading: false,
        variant: 'primary',
      },
    
          options: ['primary', 'outline'],
    
          control: { type: 'radio' },
    
          table: { defaultValue: { summary: 'primary' } },
    
    export const WithIcon: Story = {
    
    OZGCloud's avatar
    OZGCloud committed
      args: {
        text: 'I have an icon',
        variant: 'outline',
      },
      render: (args) => ({
    
        props: args,
        template: `<ods-button ${argsToTemplate(args)}>
    
    OZGCloud's avatar
    OZGCloud committed
          <ods-file-icon icon fileType='pdf' size='small'></ods-file-icon>
    
    
    export const IsLoading: Story = {
      args: {
        text: 'Loading...',
        isLoading: true,
      },
    };