forked from elastic/search-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Paging.js
37 lines (33 loc) · 831 Bytes
/
Paging.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import PropTypes from "prop-types";
import React from "react";
import RCPagination from "rc-pagination";
import enUsLocale from "rc-pagination/lib/locale/en_US";
import { appendClassName } from "./view-helpers";
function Paging({
className,
current,
resultsPerPage,
onChange,
totalPages,
...rest
}) {
return (
<RCPagination
current={current}
onChange={onChange}
pageSize={resultsPerPage}
total={totalPages * resultsPerPage}
className={appendClassName("sui-paging", className)}
locale={enUsLocale}
{...rest}
/>
);
}
Paging.propTypes = {
current: PropTypes.number.isRequired,
onChange: PropTypes.func.isRequired,
resultsPerPage: PropTypes.number.isRequired,
totalPages: PropTypes.number.isRequired,
className: PropTypes.string
};
export default Paging;