import { Spin } from "antd";
import "./loading-spinner.styles.scss";

export default function LoadingSpinner({ loading = true, message, ...props }) {
  return (
    <div className="loading-spinner">
      <Spin
        spinning={loading}
        size="large"
        style={{
          position: "relative",
          alignContent: "center"
        }}
        {...(props.children ? { description: message ? message : null } : {})}
        delay={200}
      >
        {props.children}
      </Spin>
    </div>
  );
}
