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

cms/src/posts/components/Body/EmptyRows.js   A

Complexity

Total Complexity 1
Complexity/F 0

Size

Lines of Code 24
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 21
mnd 1
bc 1
fnc 0
dl 0
loc 24
ccs 4
cts 4
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 TableCell from '@material-ui/core/TableCell'
4
import TableRow from '@material-ui/core/TableRow'
5
import { DEFAULT_LINE_HEIGHT } from 'core/const/posts'
6
7 5
const EmptyRows = ({ page, rowsPerPage, postsLength }) => {
8
  const emptyRows =
9 2
    rowsPerPage - Math.min(rowsPerPage, postsLength - page * rowsPerPage)
10 2
  return emptyRows ? (
11
    <TableRow style={{ height: DEFAULT_LINE_HEIGHT * emptyRows }}>
12
      <TableCell colSpan={6} />
13
    </TableRow>
14
  ) : null
15
}
16
17
export default EmptyRows
18
19 5
EmptyRows.propTypes = {
20
  page: PropTypes.number,
21
  rowsPerPage: PropTypes.number,
22
  postsLength: PropTypes.number
23
}
24