import { useState } from 'react';
import { SubmitButtonProps } from '@/components/RadioButton';
import { RadioButton as RadioButtonSrc } from '@/index';
import { uuid } from '@/utils/uuid';

export default {
  title: 'components',
  args: {
    label: 'A',
    checked: false,
    onClick: () => {
      // to do
    },
  },
};

export const RadioButton: React.FC<SubmitButtonProps> = ({
  label,
  checked,
  onClick,
}) => {
  const [selectedIdx, setSelectedIdx] = useState(0);
  const options = ['A', 'B', 'C', 'D'];
  return (
    <>
      basic
      <RadioButtonSrc label={label} checked={checked} onClick={onClick} />
      {/* multi
      {options.map((item, idx) => (
        <RadioButton
          key={`${uuid()}radio`}
          label={item}
          checked={selectedIdx === idx}
          onClick={() => {
            setSelectedIdx(idx);
          }}
        />
      ))} */}
    </>
  );
};
