Displayed preloader when a server is being loaded

This commit is contained in:
Alejandro Celaya
2020-03-05 08:41:55 +01:00
parent 3b0e282a52
commit 853032ac7f
7 changed files with 51 additions and 41 deletions

34
src/utils/MutedMessage.js Normal file
View File

@@ -0,0 +1,34 @@
import React from 'react';
import { Card } from 'reactstrap';
import classNames from 'classnames';
import PropTypes from 'prop-types';
import { faCircleNotch as preloader } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
const propTypes = {
noMargin: PropTypes.bool,
loading: PropTypes.bool,
children: PropTypes.node,
};
const MutedMessage = ({ children, loading = false, noMargin = false }) => {
const cardClasses = classNames('bg-light', {
'mt-4': !noMargin,
});
return (
<div className="col-md-10 offset-md-1">
<Card className={cardClasses} body>
<h3 className="text-center text-muted mb-0">
{loading && <FontAwesomeIcon icon={preloader} spin />}
{loading && !children && <span className="ml-2">Loading...</span>}
{children}
</h3>
</Card>
</div>
);
};
MutedMessage.propTypes = propTypes;
export default MutedMessage;