11import React from 'react'
22import PropTypes from 'prop-types'
33import { TablePagination , IconButton } from '@material-ui/core'
4- import { useTheme } from '@material-ui/core/styles'
4+ import { useTheme , makeStyles } from '@material-ui/core/styles'
55
66import {
77 FirstPage as FirstPageIcon ,
@@ -11,6 +11,7 @@ import {
1111} from '@material-ui/icons/'
1212
1313const BaseTablePaginationActions = props => {
14+ const classes = useStyles ( )
1415 const theme = useTheme ( )
1516 const { count, page, itemsPerPage, onChangePage } = props
1617
@@ -31,7 +32,7 @@ const BaseTablePaginationActions = props => {
3132 }
3233
3334 return (
34- < div >
35+ < div className = { classes . root } >
3536 < IconButton
3637 onClick = { handleFirstPageButtonClick }
3738 disabled = { page === 0 }
@@ -65,7 +66,7 @@ const BaseTablePaginationActions = props => {
6566}
6667
6768const BaseTablePagination = props => {
68- const { count, page, rowsPerPage, onChangePage } = props
69+ const { count, page, rowsPerPage, onChangePage, onChangeRowsPerPage = ( ) => { } } = props
6970
7071 return (
7172 < TablePagination
@@ -79,16 +80,25 @@ const BaseTablePagination = props => {
7980 native : true ,
8081 } }
8182 onChangePage = { onChangePage }
83+ onChangeRowsPerPage = { onChangeRowsPerPage }
8284 ActionsComponent = { BaseTablePaginationActions }
8385 />
8486 )
8587}
8688
89+ const useStyles = makeStyles ( theme => ( {
90+ root : {
91+ flexShrink : 0 ,
92+ marginLeft : theme . spacing ( 2.5 ) ,
93+ } ,
94+ } ) )
95+
8796BaseTablePagination . propTypes = {
8897 count : PropTypes . number . isRequired ,
89- onChangePage : PropTypes . func . isRequired ,
9098 page : PropTypes . number . isRequired ,
9199 rowsPerPage : PropTypes . number . isRequired ,
100+ onChangePage : PropTypes . func . isRequired ,
101+ onChangeRowsPerPage : PropTypes . func ,
92102}
93103
94104export default BaseTablePagination
0 commit comments