import { Spin } from "antd";
import { Suspense } from "react";
import MyCenteredSpin from "../MyCenteredSpin";

export function MySupsenseFallback({
  children,
  spinnerCentered = true,
}: {
  children: any;
  spinnerCentered?: boolean;
}) {
  return (
    <Suspense
      fallback={
        spinnerCentered ? (
          <MyCenteredSpin fullHeight />
        ) : (
          <div
            style={{
              display: "flex",
              justifyContent: "center",
              alignItems: "center",
              paddingTop: 50,
            }}
          >
            <Spin size="large" />
          </div>
        )
      }
    >
      {children}
    </Suspense>
  );
}
