/* eslint-disable react-hooks/rules-of-hooks */
import React, {useState} from 'react';
import {Meta, StoryObj} from '@storybook/react';

import {InputClassic} from './index';

const meta: Meta<typeof InputClassic> = {
  title: 'HuGo/Inputs/InputClassic',
  component: InputClassic,
  argTypes: {
    label: {type: 'string'},
    placeholder: {type: 'string'},
    helper: {type: 'string'},
    disabled: {type: 'boolean'},
    isError: {type: 'boolean'},
    isSuccess: {type: 'boolean'},
    showCounter: {type: 'boolean'},
    maxLength: {type: 'number'},
    size: {
      control: 'select',
      options: ['sm', 'lg'],
      defaultValue: 'lg',
    },
  },
};

type Story = StoryObj<typeof InputClassic>;

export const InputClassicComponent: Story = {
  args: {
    label: 'Label',
    placeholder: 'Placeholder',
    helper: 'Helper',
    disabled: false,
    isError: false,
    isSuccess: false,
    showCounter: false,
    maxLength: 20,
    size: 'lg',
  },
  render: args => {
    const [value, setValue] = useState('');
    return <InputClassic value={value} onChangeText={setValue} {...args} />;
  },
};

export const SmallInputClassic: Story = {
  args: {
    ...InputClassicComponent.args,
    size: 'sm',
    placeholder: 'Small input',
  },
  render: InputClassicComponent.render,
};

export default meta;
