-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Pagination] Fix missing renderItem types (#20592)
- Loading branch information
1 parent
241c802
commit 4dc5803
Showing
5 changed files
with
46 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React from 'react'; | ||
import { MemoryRouter, Route } from 'react-router'; | ||
import { Link } from 'react-router-dom'; | ||
import Pagination from '@material-ui/lab/Pagination'; | ||
import PaginationItem from '@material-ui/lab/PaginationItem'; | ||
|
||
export default function PaginationLink() { | ||
return ( | ||
<MemoryRouter initialEntries={['/inbox']} initialIndex={0}> | ||
<Route> | ||
{({ location }) => { | ||
const query = new URLSearchParams(location.search); | ||
const page = parseInt(query.get('page') || '1', 10); | ||
return ( | ||
<Pagination | ||
page={page} | ||
count={10} | ||
renderItem={(item) => ( | ||
<PaginationItem | ||
component={Link} | ||
to={`/inbox${item.page === 1 ? '' : `?page=${item.page}`}`} | ||
{...item} | ||
/> | ||
)} | ||
/> | ||
); | ||
}} | ||
</Route> | ||
</MemoryRouter> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters