import { Button } from "antd";
import React from "react";
import { connect } from "react-redux";
import { setModalContext } from "../../redux/modals/modals.actions";

const mapDispatchToProps = (dispatch) => ({
  setTimeTicketContext: (context) => dispatch(setModalContext({ context: context, modal: "timeTicket" }))
});

export function TimeTicketEnterButton({ actions, context, setTimeTicketContext, disabled, children }) {
  return (
    <Button
      disabled={disabled}
      onClick={() => {
        setTimeTicketContext({
          actions,
          context
        });
      }}
    >
      {children}
    </Button>
  );
}

export default connect(null, mapDispatchToProps)(TimeTicketEnterButton);
