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

const MyPostsButton = (props) => {
  const { t } = useTranslation();
  const handleClick = () => {
    props.toggleDrawer();
    history.push(MY_OFFERS_PAGE);
  }
  return (
    <DrawerButton onClick={handleClick}>
      <IconButton sx={{ borderRadius: "4px" }}>
        <PackageIcon />
      </IconButton>
      <DrawerOption>{t("header.myOffers")}</DrawerOption>
    </DrawerButton>
  );
};

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

export default MyPostsButton;
