Source

components/Spinners/LoadingHUD/LoadingHUD.js

  1. // NPM module imports
  2. import React from "react";
  3. import PropTypes from "prop-types";
  4. import { MetroSpinner } from "react-spinners-kit";
  5. // Style imports
  6. import styles from "./LoadingHUD.module.scss";
  7. /**
  8. * Renders the LoadingHUD component.
  9. * This component takes up the entire screen and blocks clicks.
  10. * The spinner itself, however, is a small HUD.
  11. * This component is typically used when submitting a form or submitting some sort of data (e.g. signing in).
  12. * @component
  13. * @category Spinners
  14. * @author Dan Levy <danlevy124@gmail.com>
  15. */
  16. const LoadingHUD = (props) => {
  17. // Returns JSX to render
  18. return (
  19. <div className={styles.background}>
  20. <div className={styles.modal}>
  21. {/* Spinner */}
  22. <MetroSpinner size={50} color="#5f9cd1" loading={true} />
  23. {/* Message */}
  24. <h3 className={styles.modalText}>{props.message}</h3>
  25. </div>
  26. </div>
  27. );
  28. };
  29. // Prop types for the LoadingHUD component
  30. LoadingHUD.propTypes = {
  31. /**
  32. * The message to display
  33. */
  34. message: PropTypes.string.isRequired,
  35. };
  36. export default LoadingHUD;