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

const LoginButton = (props) => {
  const { t } = useTranslation();
  const handleClick = () => {
    props.toggleDrawer();
    history.push(LOGIN_PAGE);
  };
  return (
    <DrawerButton onClick={handleClick}>
      <IconButton sx={{ borderRadius: "4px" }}>
        <LoginIcon />
      </IconButton>
      <DrawerOption>{t("login.headerTitle")}</DrawerOption>
    </DrawerButton>
  );
};

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

export default LoginButton;
