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

class ModButtonInfo extends React.Component<ModButtonInfoProps> {
  constructor(props: ModButtonInfoProps) {
    super(props);
  }
  render(): React.ReactNode {
    return (
      <Button
        variant={"outline"}
        disabled={this.props.isLoading}
        onClick={() => this.props.onClick()}
      >
        {this.props.isLoading ? (
          <CgSpinner size={20} className="mr-2 animate-spin" />
        ) : null}
        {this.props.isLoading
          ? this.props.isLoadingContent
          : this.props.content}
      </Button>
    );
  }
}

export { ModButtonInfo };
