import { Button } from "antd";
import BackIcon from "components/Icons/BackIcon";


interface BackButtonProps {
  navigateBack?: boolean; // true = use router.back(), false = just clear state
}

export default function BackButton({ navigateBack = true }: BackButtonProps) {
  const handleBack = () => {
    if (navigateBack) window.history.back();
  };

  return (
    <Button
      style={{
        width: 32,
        height: 32,
        display: "flex",
        alignItems: "center",
        justifyContent: "center",
        padding: 0,
        borderRadius: "50%",
      }}
      icon={
        <div style={{ position: "relative", top: 2.5, right: 1 }}>
          <BackIcon />
        </div>
      }
      onClick={handleBack}
    />
  );
}
