All files / app/src/shared/ui/button button.stories.tsx

100% Statements 70/70
100% Branches 1/1
100% Functions 1/1
100% Lines 70/70

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 791x         1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x   1x   1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x   1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x   1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
import { Story, Meta } from '@storybook/react'
import { Button, ButtonProps } from './button'
import CloseIcon from '@/shared/assets/icons/common/open-eye.svg'
import OpenEyeIcon from '@/shared/assets/icons/common/open-eye.svg'
 
export default {
  title: 'Shared/Button',
  component: Button,
  argTypes: {
    color: {
      control: 'select',
      options: ['primary', 'secondary'],
      defaultValue: 'primary',
    },
    size: {
      control: 'select',
      options: ['small', 'medium', 'large'],
      defaultValue: 'medium',
    },
    fullWidth: {
      control: 'boolean',
      defaultValue: false,
    },
    disabled: {
      control: 'boolean',
      defaultValue: false,
    },
    loading: {
      control: 'boolean',
      defaultValue: false,
    },
    children: {
      table: {
        disable: true,
      },
    },
  },
} as Meta
 
const Template: Story<ButtonProps> = args => <Button {...args}></Button>
 
export const Default = Template.bind({})
Default.args = {
  children: <h3>Кнопка</h3>,
}
Default.argTypes = {
  variant: {
    control: 'select',
    options: ['contained', 'outlined', 'text'],
    defaultValue: 'contained',
  },
}
 
export const Icon = Template.bind({})
Icon.args = {
  children: <OpenEyeIcon className='stroke-currentColor' />,
  variant: 'icon',
}
Icon.argTypes = {
  variant: {
    table: {
      disable: true,
    },
  },
}
 
export const BorderIcon = Template.bind({})
BorderIcon.args = {
  children: <CloseIcon className='stroke-currentColor' />,
  variant: 'border-icon',
}
BorderIcon.argTypes = {
  variant: {
    table: {
      disable: true,
    },
  },
}