/**
 * @description 请添加PostOnlyAndTimeInForce组件的描述和注释!!!
 *
 * @date 创建时间 2022-10-27 16:26
 * @author 开发人员
 */

import React, { useState } from "react";
import { TimeInForceEnum } from "@shared/types";
import { TimeInForce } from "../../Form/TimeInForce";
import { PostOnly } from "../../Form/PostOnly";
import { useObservable } from "rxjs-hooks";
import { onlyOrder$ } from "../orderService";
interface Props {
  show: boolean;
  postOnlyValue: boolean;
  timeInForceValue: TimeInForceEnum;
  setPostOnly: (checked: boolean) => void;
  setTimeInForce: (value: TimeInForceEnum) => void;
}

const PostOnlyAndTimeInForce: React.FC<Props> = props => {
  const { postOnlyValue, timeInForceValue, show } = props;

  return (
    <>
      {show ? (
        <div className={"flex justify-between items-center"}>
          <PostOnly checked={postOnlyValue} onChange={props.setPostOnly} />
          <TimeInForce value={timeInForceValue} onChange={props.setTimeInForce} disable={postOnlyValue} />
        </div>
      ) : (
        ""
      )}
    </>
  );
};

export default PostOnlyAndTimeInForce;
