Skip to content
Snippets Groups Projects
attachment.stories.ts 1.88 KiB
Newer Older
  • Learn to ignore specific revisions
  • import { type Meta, type StoryObj } from '@storybook/angular';
    
    import { AttachmentComponent } from './attachment.component';
    
    const meta: Meta<AttachmentComponent> = {
      title: 'Attachment',
      component: AttachmentComponent,
    
      excludeStories: /.*Data$/,
      tags: ['autodocs'],
    };
    
    export default meta;
    
    type Story = StoryObj<AttachmentComponent>;
    
    
    export const Default: Story = {
      name: 'File with pdf icon',
      args: {
    
        caption: 'Katzenanmeldung_1231231_eingang.pdf',
    
    OZGCloud's avatar
    OZGCloud committed
        errorCaption: 'Error!',
        loadingCaption: 'Loading...',
    
        description: '450 kB',
    
        fileType: 'pdf',
    
    OZGCloud's avatar
    OZGCloud committed
        isLoading: false,
        errorMessages: [],
    
      },
      argTypes: {
    
          description: 'Name of the document',
    
    OZGCloud's avatar
    OZGCloud committed
        },
        errorCaption: {
    
          description: 'Error text appears when eror messages array is not empty',
    
    OZGCloud's avatar
    OZGCloud committed
        },
        loadingCaption: {
    
          description: 'Loading text appears when isLoading flag is true',
    
        },
        description: {
    
          description: 'Description can contain size of file or e.g. loading progress',
    
    OZGCloud's avatar
    OZGCloud committed
        fileType: {
    
          description: 'Type of file icon',
    
    OZGCloud's avatar
    OZGCloud committed
        },
        isLoading: {
    
          description: 'Boolean flag for loading state',
    
    OZGCloud's avatar
    OZGCloud committed
          table: {
            defaultValue: { summary: 'false' },
          },
        },
        errorMessages: {
    
          description: 'The array containing strings with errors text',
    
      },
    };
    
    export const Doc: Story = {
      name: 'File with doc icon',
      args: {
    
        caption: 'Katzenanmeldung_1231231_eingang.doc',
    
        description: '573 kB',
    
        fileType: 'doc',
    
    export const Loading: Story = {
    
      name: 'File with loading icon',
    
      args: {
    
    OZGCloud's avatar
    OZGCloud committed
        loadingCaption: 'Katzenanmeldung_1231231_eingang.doc',
    
        description: '573 kB',
    
        fileType: 'doc',
        isLoading: true,
    
    
    export const Error: Story = {
      name: 'Error message in file',
      args: {
    
    OZGCloud's avatar
    OZGCloud committed
        errorCaption: 'Fehler beim Hochladen',
    
        errorMessages: ['Erlaubte Dateiendungen: pdf, jpg, png, jpeg'],