/**
 * 下单按钮
 */
import React, { FC } from "react";
import { Button } from "@components/Button";
import { OrderSideEnum } from "@shared/types";

interface Props {
  onClick: (type: OrderSideEnum) => void;
  buyText: string;
  sellText: string;
}
export const Buttons: FC<Props> = props => {
  const handleSubmit = (event: React.MouseEvent<HTMLElement, MouseEvent>, type: OrderSideEnum) => {
    event?.preventDefault();
    props?.onClick?.(type);
  };
  return (
    <div className={"flex mb-[20px]"}>
      <Button
        color="green"
        variant="contained"
        className="!h-[40px] flex-1"
        onClick={e => handleSubmit(e, OrderSideEnum.Buy)}
        type="button"
      >
        {props.buyText}
      </Button>
      <Button
        color="red"
        className="ml-[12px] !h-[40px] flex-1"
        variant="contained"
        onClick={e => handleSubmit(e, OrderSideEnum.Sell)}
        type="button"
      >
        {props.sellText}
      </Button>
    </div>
  );
};
