Completed
Push — master ( 3b0e28...451c77 )
by Alejandro
14:49 queued 05:57
created

src/utils/MutedMessage.js

Complexity

Total Complexity 0
Complexity/F 0

Size

Lines of Code 35
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 0
eloc 30
mnd 0
bc 0
fnc 0
dl 0
loc 35
ccs 5
cts 5
cp 1
bpm 0
cpm 0
noi 0
c 0
b 0
f 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