import { Meta, StoryObj } from '@storybook/react';
import React from 'react';
import { MemoryRouter } from 'react-router';
import { enumToObj } from '../../../helpers/storybook';
import { ButtonContext } from '../Button.model';
import { TextButton } from './TextButton';

const typeOptions = enumToObj(ButtonContext);

const meta: Meta<typeof TextButton> = {
  title: 'Other Components/Buttons/TextButton',
  component: TextButton,
  argTypes: {
    buttonContext: {
      control: {
        type: 'radio',
      },
      options: typeOptions,
    },
    type: {
      control: false,
    },
    onBlur: {
      control: false,
    },
    width: {
      control: {
        type: 'number',
      },
    },
    height: {
      control: {
        type: 'number',
      },
    },
  },
  decorators: [
    // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
    (Story) => (
      <MemoryRouter>
        <Story />
      </MemoryRouter>
    ),
  ],
};

export default meta;

export const textButton: StoryObj = {
  args: {
    type: 'button',
    text: 'Placeholder',
  },
};
