import UpdateList from "@/components/icons/UpdateList";
import { Button, CircularProgress } from "@mui/material";

function UpdateBtn({ updateData, loading }) {
  return (
    <Button
      variant="outlined"
      onClick={updateData}
      disabled={loading}
      className={` !border-[#5559CE] !border-[2px] !relative !py-[6px] md:!py-2 lg:!py-[9px] !px-[8px] sm:!px-[15px] md:!px-[21px] lg:!px-[28px] !mr-0 md:!mr-4 `}
    >
      {loading && (
        <CircularProgress
          className="!absolute !right-[45%] !top-[25%]"
          size={20}
        />
      )}
      <div
        className={`!flex !items-center !justify-center !gap-2 !text-[14px] !font-medium ${loading ? "opacity-0" : "opacity-100"}`}
      >
        <UpdateList />
        آپدیت کردن
      </div>
    </Button>
  );
}

export default UpdateBtn;
