import React, { FC } from "react";
import { Spin, SpinProps } from "antd";

export interface DageLoadingProps extends SpinProps {
  style?: React.CSSProperties;
  className?: string;
}

export const DageLoading: FC<DageLoadingProps> = React.memo(
  ({ style, className, ...rest }) => {
    return (
      <div
        className={className}
        style={{
          position: "absolute",
          top: 0,
          left: 0,
          right: 0,
          bottom: 0,
          backgroundColor: "rgba(255,255,255,.8)",
          display: "flex",
          justifyContent: "center",
          alignItems: "center",
          zIndex: 9999,
          ...style,
        }}
      >
        <Spin size="large" {...rest} />
      </div>
    );
  }
);
