import React from "react";
import { ComponentStory, ComponentMeta } from "@storybook/react";

import { Toast } from "../ui-components/Toast";
import { ToastInfo } from "../ui-components/Toast/ToastInfo";

export default {
  title: "Containers/Toast",
  component: Toast,
} as ComponentMeta<typeof Toast>;

const InfoTemplate: ComponentStory<typeof Toast> = (args) => (
  <>
    <ToastInfo />
    <div style={{ position: "absolute", right: 0, marginTop: "100px" }}>
      <Toast
        style={{ position: "relative" }}
        {...{
          variant: "success",
          message: "Roo-hoo!",
          description: "Shift request was successfully confirmed.",
          color: "#E6F2EE",
          borderColor: "#007A4C",
          remainsOnPage: true,
        }}
      ></Toast>
      <br />
      <Toast
        style={{ position: "relative" }}
        {...{
          variant: "warning",
          message: "Uh-oh, something went wrong",
          description: "The form could not be submitted right now.",
          color: "#FDF9E9",
          borderColor: "#E7C21C",
          remainsOnPage: true,
        }}
      ></Toast>
      <br />
      <Toast
        style={{ position: "relative" }}
        {...{
          variant: "error",
          message: "Error",
          description: "The form could not be submitted right now.",
          color: "#FDE8E8",
          borderColor: "#E81616",
          remainsOnPage: true,
        }}
      ></Toast>
      <br />
      <Toast
        style={{ position: "relative" }}
        {...{
          message: "Did you know?",
          description: "Check out Roo4You for more information.",
          remainsOnPage: true,
        }}
      ></Toast>
      <br />
    </div>
  </>
);

const Template: ComponentStory<typeof Toast> = (args) => (
  <Toast {...args}></Toast>
);

export const ToastDetails = InfoTemplate.bind({});

export const Success = Template.bind({});
Success.args = {
  variant: "success",
  message: "Roo-hoo!",
  description: "Shift request was successfully confirmed.",
  color: "#E6F2EE",
  borderColor: "#007A4C",
};

export const Warning = Template.bind({});
Warning.args = {
  variant: "warning",
  message: "Uh-oh, something went wrong",
  description: "The form could not be submitted right now.",
  color: "#FDF9E9",
  borderColor: "#E7C21C",
};

export const Error = Template.bind({});
Error.args = {
  variant: "error",
  message: "Error",
  description: "The form could not be submitted right now.",
  color: "#FDE8E8",
  borderColor: "#E81616",
};

export const Info = Template.bind({});
Info.args = {
  message: "Did you know?",
  description: "Check out Roo4You for more information.",
};
