import { Box } from "@mantine/core"
import { ArrowLeftIcon } from "@phosphor-icons/react"
import { useRouter } from "@tanstack/react-router"

const BackButton = ({ top=20, left=20 }: { top?: number, left?: number }) => {
  const router = useRouter()

  return (
    <Box
      style={{ cursor: 'pointer', zIndex: 1000 }}
      onClick={() => router.history.back()}
      pos='absolute'
      left={left}
      top={top}
    >
      <ArrowLeftIcon weight='bold' size={20} />
    </Box>
  );
}

export default BackButton;
