import React from "react";
import { Meta, Story } from "@storybook/react";
import {
  MoleculeHistoryCard,
  IHistoryCardProps,
} from "react/molecules/HistoryCard/index";
import { action } from "@storybook/addon-actions";
import { theme } from "data/dataMx";

const meta: Meta = {
  title: "React/molecules/HistoryCard",
  component: MoleculeHistoryCard,
  argTypes: {
    iconColor: {
      control: {
        type: "select",
      },
      options: Object.keys(theme),
    },
    iconCaptionColor: {
      control: {
        type: "select",
      },
      options: Object.keys(theme),
    },
  },
  parameters: {
    controls: { expanded: true },
  },
};

export default meta;

const TemplateHistoryCard: Story<IHistoryCardProps> = (props) => (
  <MoleculeHistoryCard {...props} />
);

export const HistoryCard = TemplateHistoryCard.bind({});

const TemplateHistoryCardWithTag: Story<IHistoryCardProps> = (props) => (
  <MoleculeHistoryCard {...props} />
);

export const HistoryCardWithTag = TemplateHistoryCardWithTag.bind({});

const TemplateHistoryCardSimple: Story<IHistoryCardProps> = (props) => (
  <MoleculeHistoryCard {...props} />
);

export const HistoryCardSimple = TemplateHistoryCardSimple.bind({});

HistoryCard.args = {
  cardWidth: "500px",
  iconName: "badge",
  iconSize: 25,
  iconCaptionText: "- 100 points",
  iconCaptionColor: "neutral400",
  date: "05/04/2022",
  dateDescription: "promo redemption",
  isClickable: false,
  onClick: action("Event Click"),
};

HistoryCardWithTag.args = {
  cardWidth: "500px",
  iconName: "badge",
  iconSize: 25,
  iconCaptionText: "+ 50 points",
  iconCaptionColor: "primary",
  iconDescriptionText: "National Recycling League take the pledge Givaway",
  date: "05/04/2022",
  isClickable: true,
  tagText: "Acepted",
  onClick: action("Event Click"),
};

HistoryCardSimple.args = {
  cardWidth: "500px",
  iconName: "earn_scan",
  iconSize: 45,
  iconCaptionText: "Upload Receipts",
  iconCaptionColor: "neutral700",
  isClickable: true,
  onClick: action("Event Click"),
};
