import { Box } from "@mantine/core"
import { GearIcon } from "@phosphor-icons/react"
import { useNavigate } from "@tanstack/react-router"
import { memo } from "react";

interface SettingButtonProps {
  to: string;
  top?: number;
  right?: number;
}

const SettingsButton = ({ to }: SettingButtonProps) => {
  const navigate = useNavigate();

  return (
    <Box
      style={{ cursor: 'pointer', zIndex: 1000 }}
      onClick={() => navigate({ to })}
      pos='absolute'
      right={20}
      top={6}
    >
      <GearIcon weight='bold' size={20} />
    </Box>
  );
}

export default memo(SettingsButton, (prev, next) => prev.to !== next.to);
