Passed
Push — master ( 9a73f0...7331d4 )
by Huu-Phat
01:50 queued 11s
created

cms/src/posts/components/Posts/SelectedToolbar.js   A

Complexity

Total Complexity 1
Complexity/F 0

Size

Lines of Code 49
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 41
mnd 1
bc 1
fnc 0
dl 0
loc 49
ccs 3
cts 3
cp 1
bpm 0
cpm 0
noi 0
c 0
b 0
f 0
rs 10
1
import React from 'react'
2
import PropTypes from 'prop-types'
3
import clsx from 'clsx'
4
import Toolbar from '@material-ui/core/Toolbar'
5
import Typography from '@material-ui/core/Typography'
6
import IconButton from '@material-ui/core/IconButton'
7
import Tooltip from '@material-ui/core/Tooltip'
8
import DeleteIcon from '@material-ui/icons/Delete'
9
10 4
const SelectedToolbar = ({ classes, numSelected }) => (
11 2
  <Toolbar
12
    className={clsx(classes.root, {
13
      [classes.highlight]: numSelected
14
    })}
15
  >
16
    {numSelected ? (
17
      <React.Fragment>
18
        <Typography
19
          className={classes.title}
20
          color="inherit"
21
          variant="subtitle1"
22
        >
23
          {numSelected} selected
24
        </Typography>
25
        <Tooltip title="Delete">
26
          <IconButton aria-label="delete">
27
            <DeleteIcon />
28
          </IconButton>
29
        </Tooltip>
30
      </React.Fragment>
31
    ) : (
32
      <Typography className={classes.title} variant="h6">
33
        All Posts
34
      </Typography>
35
    )}
36
  </Toolbar>
37
)
38
39 4
SelectedToolbar.propTypes = {
40
  numSelected: PropTypes.number.isRequired,
41
  classes: PropTypes.shape({
42
    root: PropTypes.string,
43
    title: PropTypes.string,
44
    highlight: PropTypes.string
45
  })
46
}
47
48
export default SelectedToolbar
49