Source

components/Spinners/LoadingContainer/LoadingContainer.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 "./LoadingContainer.module.scss";
  7. /**
  8. * Renders the LoadingContainer component.
  9. * This component takes up the entire width and height of its parent component.
  10. * This component is typically used when loading a page of data (e.g. a list of users).
  11. * @component
  12. * @category Spinners
  13. * @author Dan Levy <danlevy124@gmail.com>
  14. */
  15. const LoadingContainer = (props) => {
  16. // Returns the JSX to render
  17. return (
  18. <div className={styles.loadingContainer}>
  19. {/* Spinner */}
  20. <MetroSpinner size={75} color="#5F9CD1" loading={true} />
  21. {/* Message */}
  22. <h1 className={styles.loadingContainerMessage}>{props.message}</h1>
  23. </div>
  24. );
  25. };
  26. // Prop types for the LoadingContainer component
  27. LoadingContainer.propTypes = {
  28. /**
  29. * The message to display
  30. */
  31. message: PropTypes.string.isRequired,
  32. };
  33. export default LoadingContainer;