| Total Complexity | 0 |
| Complexity/F | 0 |
| Lines of Code | 35 |
| Function Count | 0 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | import React from 'react'; |
||
| 2 | import { Card } from 'reactstrap'; |
||
| 3 | import classNames from 'classnames'; |
||
| 4 | import PropTypes from 'prop-types'; |
||
| 5 | import { faCircleNotch as preloader } from '@fortawesome/free-solid-svg-icons'; |
||
| 6 | import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; |
||
| 7 | |||
| 8 | 2 | const propTypes = { |
|
| 9 | noMargin: PropTypes.bool, |
||
| 10 | loading: PropTypes.bool, |
||
| 11 | children: PropTypes.node, |
||
| 12 | }; |
||
| 13 | |||
| 14 | 2 | const MutedMessage = ({ children, loading = false, noMargin = false }) => { |
|
| 15 | 5 | const cardClasses = classNames('bg-light', { |
|
| 16 | 'mt-4': !noMargin, |
||
| 17 | }); |
||
| 18 | |||
| 19 | 5 | return ( |
|
| 20 | <div className="col-md-10 offset-md-1"> |
||
| 21 | <Card className={cardClasses} body> |
||
| 22 | <h3 className="text-center text-muted mb-0"> |
||
| 23 | {loading && <FontAwesomeIcon icon={preloader} spin />} |
||
| 24 | {loading && !children && <span className="ml-2">Loading...</span>} |
||
| 25 | {children} |
||
| 26 | </h3> |
||
| 27 | </Card> |
||
| 28 | </div> |
||
| 29 | ); |
||
| 30 | }; |
||
| 31 | |||
| 32 | 2 | MutedMessage.propTypes = propTypes; |
|
| 33 | |||
| 34 | export default MutedMessage; |
||
| 35 |