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

import {InputDate} from './index';

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

type Story = StoryObj<typeof InputDate>;

export const InputDateComponent: Story = {
  args: {
    label: 'Label',
    placeholder: 'DD/MM/YYYY',
    helper: 'Helper',
    disabled: false,
    isError: false,
    isSuccess: false,
    size: 'lg',
  },
  render: args => {
    const [value, setValue] = useState<Date | undefined>();
    return <InputDate value={value} onChange={setValue} {...args} />;
  },
};

export const SmallInputDate: Story = {
  args: {
    ...InputDateComponent.args,
    size: 'sm',
  },
  render: InputDateComponent.render,
};

export default meta;
