import { Story, Meta } from "@storybook/react";

import Radio, { RadioProps } from "./Radio";
import Block from "../Block/Block";

export default {
  title: "Component/Atoms/Radio",
  component: Radio,
  parameters: {
    component: Radio,
    previewTabs: {
      canvas: {
        hidden: true,
      },
    },
    viewMode: "docs",
  },
} as Meta;

interface ExampleProps {
  children?: React.ReactNode;
  classes: string;
}

const Template: Story<RadioProps> = (args) => <Radio {...args}></Radio>;

const Example: Story<ExampleProps> = (args) => {
  const classes = args.classes;
  return classes ? (
    <Block className={args.classes}>{args.children}</Block>
  ) : (
    <>{args.children}</>
  );
};

export const Properties = Template.bind({});
Properties.args = {};

export const Types = Example.bind({});
Types.args = {
  children: (
    <Block className="grid grid-cols-4 grid-rows-2 gap-4 ">
      <Radio />
      <Radio variation="default" />
      <Radio variation="primary" />
      <Radio variation="secondary" />
      <Radio checked />
      <Radio checked variation="default" />
      <Radio checked variation="primary" />
      <Radio checked variation="secondary" />
    </Block>
  ),
  classes: "h-64 flex justify-center items-center w-full",
};

export const StyledRadio = Example.bind({});
StyledRadio.args = {
  children: (
    <Block className="flex items-center justify-center h-64 space-x-6">
      <Radio checked className="text-red-600 "></Radio>
      <Radio checked className="text-green-600 "></Radio>
      <Radio checked className="text-blue-600 "></Radio>
      <Radio checked className="text-purple-600 "></Radio>
      <Radio checked className="text-yellow-600 "></Radio>
      <Radio checked className="text-orange-600 "></Radio>
    </Block>
  ),
};
