import cx from "classnames";
import React, { ReactNode } from "react";
import { Container } from "../Container";
import { Loader } from "./Loader";

const CLASS_ROOT = "loader-fullscreen";

interface LoaderFullscreenProps {
  className?: string;
  children?: ReactNode;
}

const LoaderFullscreen: React.FC<LoaderFullscreenProps> = ({
  className,
  children,
  ...other
}) => {
  const classes = cx(CLASS_ROOT, className);

  return (
    <div className={classes} role="status" aria-live="polite" {...other}>
      <Container>
        {children}
        <Loader size="large" />
      </Container>
    </div>
  );
};

LoaderFullscreen.displayName = "LoaderFullscreen";

export { LoaderFullscreen };
