src/visits/helpers/GraphCard.js   A
last analyzed

Complexity

Total Complexity 1
Complexity/F 0

Size

Lines of Code 31
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 28
mnd 1
bc 1
fnc 0
dl 0
loc 31
rs 10
bpm 0
cpm 0
noi 0
c 0
b 0
f 0
ccs 4
cts 4
cp 1
1
import { Card, CardHeader, CardBody, CardFooter } from 'reactstrap';
2
import PropTypes from 'prop-types';
3
import React from 'react';
4
import DefaultChart from './DefaultChart';
5
import './GraphCard.scss';
6
7 3
const propTypes = {
8
  title: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]),
9
  footer: PropTypes.oneOfType([ PropTypes.string, PropTypes.node ]),
10
  isBarChart: PropTypes.bool,
11
  stats: PropTypes.object,
12
  max: PropTypes.number,
13
  highlightedStats: PropTypes.object,
14
  highlightedLabel: PropTypes.string,
15
  onClick: PropTypes.func,
16
};
17
18 3
const GraphCard = ({ title, footer, ...rest }) => (
19 4
  <Card>
20
    <CardHeader className="graph-card__header">{typeof title === 'function' ? title() : title}</CardHeader>
21
    <CardBody>
22
      <DefaultChart title={title} {...rest} />
23
    </CardBody>
24
    {footer && <CardFooter className="graph-card__footer--sticky">{footer}</CardFooter>}
25
  </Card>
26
);
27
28 3
GraphCard.propTypes = propTypes;
29
30
export default GraphCard;
31