Skip to content

Commit c60e632

Browse files
PR changes
1 parent 1750e65 commit c60e632

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ or
1818
Install `react-paginate` with [npm](https://www.npmjs.com/):
1919

2020
```
21-
$ npm install react-paginate --save
21+
npm install react-paginate --save
2222
```
2323

2424
For [CommonJS](http://wiki.commonjs.org/wiki/CommonJS) users:
@@ -35,26 +35,26 @@ how to make `react-paginate` work with a list of objects.
3535
Clone the repository and move into:
3636

3737
```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
4040
```
4141

4242
Install dependencies:
4343

4444
```console
45-
$ make install
45+
make install
4646
```
4747

4848
Prepare the demo:
4949

5050
```console
51-
$ make demo
51+
make demo
5252
```
5353

5454
Run the server:
5555

5656
```console
57-
$ make serve
57+
make serve
5858
```
5959

6060
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/)
8080
| `containerClassName` | `String` | The classname of the pagination container. |
8181
| `pageClassName` | `String` | The classname on tag `li` of each page element. |
8282
| `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` |
8484
| `activeClassName` | `String` | The classname for the active page. |
8585
| `activeLinkClassName` | `String` | The classname on the active tag `a`. |
8686
| `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/)
106106
Run tests:
107107

108108
```console
109-
$ make test
109+
make test
110110
```
111111

112112
[1]: https://github.com/AdeleD/react-paginate/blob/master/demo/js/demo.js

__tests__/PaginationBoxView-test.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1268,7 +1268,10 @@ describe('Test custom props', () => {
12681268
const pagination = ReactTestUtils.renderIntoDocument(
12691269
<PaginationBoxView
12701270
pageCount={data.length}
1271-
pageLabelRender={(index) => data[index]?.name}
1271+
pageLabelRender={(page) => {
1272+
const pageIndex = page - 1;
1273+
return data[pageIndex]?.name
1274+
}}
12721275
/>
12731276
);
12741277

react_components/PageView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const PageView = (props) => {
5454
onKeyPress={pageSelectedHandler}
5555
{...getEventListener(pageSelectedHandler)}
5656
>
57-
{pageLabelRender(page - 1)}
57+
{pageLabelRender(page)}
5858
</a>
5959
</li>
6060
);

react_components/PaginationBoxView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export default class PaginationBoxView extends Component {
5656
breakLabel: '...',
5757
disabledClassName: 'disabled',
5858
disableInitialCallback: false,
59-
pageLabelRender: (index) => index + 1,
59+
pageLabelRender: (page) => page,
6060
eventListener: 'onClick',
6161
};
6262

0 commit comments

Comments
 (0)