import { Button } from "@/components/ui/button";
import React from "react";
import { ModButtonIconBorderedProps } from "./TButton";
import { CgSpinner } from "react-icons/cg";

class ModButtonIconBordered extends React.Component<ModButtonIconBorderedProps> {
  constructor(props: ModButtonIconBorderedProps) {
    super(props);
  }
  render(): React.ReactNode {
    return (
      <Button
        disabled={this.props.isLoading}
        onClick={() => this.props.onClick()}
        size={"icon"}
        variant={"outline"}
        style={{ minWidth: 40, height: 40 }}
      >
        {this.props.isLoading ? (
          <CgSpinner size={20} className="mr-2 animate-spin" />
        ) : (
          <div>{this.props.icon}</div>
        )}
      </Button>
    );
  }
}

export { ModButtonIconBordered };
