import React from "react";
import PropTypes from "prop-types";
import { useTranslation } from "react-i18next";
import history from "../../../../../store/utils/history";
import { REGISTER_PAGE } from "../../../../../constants/pages";
import { DrawerButton, DrawerOption } from "../../Drawer.styled";
import { IconButton } from "../../../../Buttons/IconButton/IconButton";
import { RegisterIcon } from "./RegisterButton.styled";

const RegisterButton = (props) => {
  const { t } = useTranslation();
  const handleClick = () => {
    props.toggleDrawer();
    history.push(REGISTER_PAGE);
  };
  return (
    <DrawerButton onClick={handleClick}>
      <IconButton sx={{ borderRadius: "4px" }}>
        <RegisterIcon />
      </IconButton>
      <DrawerOption>{t("register.headerTitle")}</DrawerOption>
    </DrawerButton>
  );
};

RegisterButton.propTypes = {
  toggleDrawer: PropTypes.func,
};

export default RegisterButton;
