File tree Expand file tree Collapse file tree 4 files changed +14
-11
lines changed Expand file tree Collapse file tree 4 files changed +14
-11
lines changed Original file line number Diff line number Diff line change 18
18
Install ` react-paginate ` with [ npm] ( https://www.npmjs.com/ ) :
19
19
20
20
```
21
- $ npm install react-paginate --save
21
+ npm install react-paginate --save
22
22
```
23
23
24
24
For [ CommonJS] ( http://wiki.commonjs.org/wiki/CommonJS ) users:
@@ -35,26 +35,26 @@ how to make `react-paginate` work with a list of objects.
35
35
Clone the repository and move into:
36
36
37
37
``` console
38
- $ git clone git@github.com:AdeleD/react-paginate.git
39
- $ cd react-paginate
38
+ git clone git@github.com:AdeleD/react-paginate.git
39
+ cd react-paginate
40
40
```
41
41
42
42
Install dependencies:
43
43
44
44
``` console
45
- $ make install
45
+ make install
46
46
```
47
47
48
48
Prepare the demo:
49
49
50
50
``` console
51
- $ make demo
51
+ make demo
52
52
```
53
53
54
54
Run the server:
55
55
56
56
``` console
57
- $ make serve
57
+ make serve
58
58
```
59
59
60
60
Open your browser and go to [ http://localhost:3000/ ] ( http://localhost:3000/ )
@@ -80,7 +80,7 @@ Open your browser and go to [http://localhost:3000/](http://localhost:3000/)
80
80
| ` containerClassName ` | ` String ` | The classname of the pagination container. |
81
81
| ` pageClassName ` | ` String ` | The classname on tag ` li ` of each page element. |
82
82
| ` pageLinkClassName ` | ` String ` | The classname on tag ` a ` of each page element. |
83
- | ` pageLabelRender ` | ` Function ` | Function to set the text on page links. Defaults to ` (index ) => index + 1 ` |
83
+ | ` pageLabelRender ` | ` Function ` | Function to set the text on page links. Defaults to ` (page ) => page ` |
84
84
| ` activeClassName ` | ` String ` | The classname for the active page. |
85
85
| ` activeLinkClassName ` | ` String ` | The classname on the active tag ` a ` . |
86
86
| ` previousClassName ` | ` String ` | The classname on tag ` li ` of the ` previous ` button. |
@@ -106,7 +106,7 @@ Open your browser and go to [http://localhost:3000/](http://localhost:3000/)
106
106
Run tests:
107
107
108
108
``` console
109
- $ make test
109
+ make test
110
110
```
111
111
112
112
[ 1 ] : https://github.com/AdeleD/react-paginate/blob/master/demo/js/demo.js
Original file line number Diff line number Diff line change @@ -1268,7 +1268,10 @@ describe('Test custom props', () => {
1268
1268
const pagination = ReactTestUtils . renderIntoDocument (
1269
1269
< PaginationBoxView
1270
1270
pageCount = { data . length }
1271
- pageLabelRender = { ( index ) => data [ index ] ?. name }
1271
+ pageLabelRender = { ( page ) => {
1272
+ const pageIndex = page - 1 ;
1273
+ return data [ pageIndex ] ?. name
1274
+ } }
1272
1275
/>
1273
1276
) ;
1274
1277
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ const PageView = (props) => {
54
54
onKeyPress = { pageSelectedHandler }
55
55
{ ...getEventListener ( pageSelectedHandler ) }
56
56
>
57
- { pageLabelRender ( page - 1 ) }
57
+ { pageLabelRender ( page ) }
58
58
</ a >
59
59
</ li >
60
60
) ;
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ export default class PaginationBoxView extends Component {
56
56
breakLabel : '...' ,
57
57
disabledClassName : 'disabled' ,
58
58
disableInitialCallback : false ,
59
- pageLabelRender : ( index ) => index + 1 ,
59
+ pageLabelRender : ( page ) => page ,
60
60
eventListener : 'onClick' ,
61
61
} ;
62
62
You can’t perform that action at this time.
0 commit comments