import React from "react";
import { Meta, Story } from "@storybook/react";
import { AtomButtonBack, IPropsBackButton } from "react/atoms/Buttons/Back";
import { action } from "@storybook/addon-actions";
import { theme } from "data/dataMx";

const meta: Meta = {
  title: "React/atoms/Button/Back",
  component: AtomButtonBack,
  argTypes: {
    onClick: {
      table: {
        disable: true,
      },
    },
    arrowColor: {
      control: {
        type: "select",
      },
      options: Object.keys(theme),
    },
  },
  parameters: {
    controls: { expanded: true },
  },
};

export default meta;

const TemplateBack: Story<IPropsBackButton> = (props) => (
  <AtomButtonBack {...props} />
);

// By passing using the Args format for exported stories, you can control the props for a component for reuse in a test
// https://storybook.js.org/docs/react/workflows/unit-testing
export const Back = TemplateBack.bind({});

Back.args = {
  disabled: false,
  onClick: action("Event Click"),
  text: "Back to rewards",
  minWidth: "100px",
  width: "140px",
};
