"use client"

import { faSpinner } from "@fortawesome/free-solid-svg-icons"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import { Spin } from "antd"
import Image from "next/image"

type IProps = {
  className?: string
  icon?: string
}

export function LoadingBox({ className, icon }: IProps) {
  return (
    <div className={`h-full grow flex justify-center items-center py-4 ${className ? className : ""}`}>
      {icon ? (
        <Image alt="loading" src={icon} width={100} height={100} className="aspect-square" />
      ) : (
        <Spin
        indicator={
          <FontAwesomeIcon
            icon={faSpinner}
            spin
          />
        }
        size="large"
      />
      )}
    </div>
  )
}
