adding position prop into pagination component (#1205)

- adding isTop prop into pagination component, which allows
differentiate if pagination is on top or bottom of the table
This commit is contained in:
Andrej Gajdos 2019-01-31 18:08:06 +01:00 committed by Tanner Linsley
parent 26961d0994
commit c7d2c36454

View File

@ -796,7 +796,7 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
)
}
const makePagination = () => {
const makePagination = (isTop) => {
const paginationProps = _.splitProps(
getPaginationProps(finalState, undefined, undefined, this)
)
@ -810,13 +810,13 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
onPageSizeChange={this.onPageSizeChange}
className={paginationProps.className}
style={paginationProps.style}
isTop={isTop}
{...paginationProps.rest}
/>
)
}
const makeTable = () => {
const pagination = makePagination()
return (
<div
className={classnames('ReactTable', className, rootProps.className)}
@ -827,7 +827,7 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
{...rootProps.rest}
>
{showPagination && showPaginationTop ? (
<div className="pagination-top">{pagination}</div>
<div className="pagination-top">{makePagination(true)}</div>
) : null}
<TableComponent
className={classnames(tableProps.className, currentlyResizing ? 'rt-resizing' : '')}
@ -851,7 +851,7 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
{hasColumnFooter ? makeColumnFooters() : null}
</TableComponent>
{showPagination && showPaginationBottom ? (
<div className="pagination-bottom">{pagination}</div>
<div className="pagination-bottom">{makePagination(false)}</div>
) : null}
{!pageRows.length && (
<NoDataComponent {...noDataProps}>{_.normalizeComponent(noDataText)}</NoDataComponent>