forked from mui/material-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump react-router-dom to ^6.0.1 (mui#29553)
Co-authored-by: Renovate Bot <[email protected]> Co-authored-by: eps1lon <[email protected]> Co-authored-by: Michał Dudak <[email protected]>
- Loading branch information
1 parent
4323c77
commit 38ac830
Showing
26 changed files
with
492 additions
and
284 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
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 |
---|---|---|
@@ -1,30 +1,33 @@ | ||
import * as React from 'react'; | ||
import { Link, MemoryRouter, Route } from 'react-router-dom'; | ||
import { Link, MemoryRouter, Route, Routes, useLocation } from 'react-router-dom'; | ||
import Pagination from '@mui/material/Pagination'; | ||
import PaginationItem from '@mui/material/PaginationItem'; | ||
|
||
function Content() { | ||
const location = useLocation(); | ||
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} | ||
/> | ||
)} | ||
/> | ||
); | ||
} | ||
|
||
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> | ||
<Routes> | ||
<Route path="*" element={<Content />} /> | ||
</Routes> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,33 @@ | ||
import * as React from 'react'; | ||
import { Link, MemoryRouter, Route } from 'react-router-dom'; | ||
import { Link, MemoryRouter, Route, Routes, useLocation } from 'react-router-dom'; | ||
import Pagination from '@mui/material/Pagination'; | ||
import PaginationItem from '@mui/material/PaginationItem'; | ||
|
||
function Content() { | ||
const location = useLocation(); | ||
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} | ||
/> | ||
)} | ||
/> | ||
); | ||
} | ||
|
||
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> | ||
<Routes> | ||
<Route path="*" element={<Content />} /> | ||
</Routes> | ||
</MemoryRouter> | ||
); | ||
} |
5 changes: 5 additions & 0 deletions
5
docs/src/pages/components/pagination/PaginationLink.tsx.preview
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,5 @@ | ||
<MemoryRouter initialEntries={['/inbox']} initialIndex={0}> | ||
<Routes> | ||
<Route path="*" element={<Content />} /> | ||
</Routes> | ||
</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
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
Oops, something went wrong.