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

import {InputPercentage} from './index';

const meta: Meta<typeof InputPercentage> = {
  title: 'HuGo/Inputs/InputPercentage',
  component: InputPercentage,
  argTypes: {
    label: {type: 'string'},
    helper: {type: 'string'},
    disabled: {type: 'boolean'},
    isError: {type: 'boolean'},
    isSuccess: {type: 'boolean'},
    withDecimals: {type: 'boolean'},
  },
};

type Story = StoryObj<typeof InputPercentage>;

export const InputPercentageComponent: Story = {
  args: {
    label: 'Label',
    helper: 'Helper',
    disabled: false,
    isError: false,
    isSuccess: false,
    withDecimals: false,
  },
  render: args => {
    const [value, setValue] = useState('');
    return <InputPercentage value={value} onChangeText={setValue} {...args} />;
  },
};

export const SmallInputPercentage: Story = {
  args: {
    ...InputPercentageComponent.args,
    size: 'sm',
  },
  render: InputPercentageComponent.render,
};

export default meta;
