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

import { DatePickerProps } from "./DatePicker";
import Block from "../../atoms/Block";
import DatePicker from ".";

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

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

const Template: Story<DatePickerProps> = (args) => (
  <Block className="h-[400px]">
    <DatePicker {...args}></DatePicker>
  </Block>
);

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 MaxWidth = Example.bind({});
MaxWidth.args = {
  children: <DatePicker />,
  classes: "w-full h-[400px] max-w-xs",
};

export const Variations = Example.bind({});
Variations.args = {
  children: (
    <Block className="flex space-x-6 h-[480px]">
      <DatePicker variation="default" />
      <DatePicker variation="primary" />
      <DatePicker variation="secondary" />
    </Block>
  ),
};
