Skip to content

Commit

Permalink
[docs] Bump React Router to ^7.0.1 (#44531)
Browse files Browse the repository at this point in the history
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
  • Loading branch information
renovate[bot] and oliviertassinari authored Dec 2, 2024
1 parent 07c1590 commit 1f3d69a
Show file tree
Hide file tree
Showing 27 changed files with 98 additions and 53 deletions.
4 changes: 2 additions & 2 deletions docs/data/base/components/tabs/UnstyledTabsRouting.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import { Tab as BaseTab, tabClasses } from '@mui/base/Tab';
import { TabsList as BaseTabsList } from '@mui/base/TabsList';
import {
MemoryRouter,
StaticRouter,
Route,
Routes,
Link,
matchPath,
useLocation,
} from 'react-router-dom';
import { StaticRouter } from 'react-router-dom/server';
} from 'react-router';
import { styled } from '@mui/system';

function Router(props) {
Expand Down
4 changes: 2 additions & 2 deletions docs/data/base/components/tabs/UnstyledTabsRouting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { Tab as BaseTab, TabRootSlotProps, tabClasses } from '@mui/base/Tab';
import { TabsList as BaseTabsList } from '@mui/base/TabsList';
import {
MemoryRouter,
StaticRouter,
Route,
Routes,
Link,
matchPath,
useLocation,
} from 'react-router-dom';
import { StaticRouter } from 'react-router-dom/server';
} from 'react-router';
import { styled } from '@mui/system';

function Router(props: { children?: React.ReactNode }) {
Expand Down
6 changes: 3 additions & 3 deletions docs/data/joy/components/link/link.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ import Link from '@mui/joy/Link';
</NextLink>;
```

### React Router
### React Router

Here is an example with the [Link component](https://reactrouter.com/en/main/components/link) of React Router:
Here is a demo with the [Link component](https://reactrouter.com/start/library/navigating#link) of [React Router](https://github.com/remix-run/react-router).

```js
import { Link as RouterLink } from 'react-router-dom';
import { Link as RouterLink } from 'react-router';
import Link from '@mui/joy/Link';

<Link component={RouterLink} to="/docs">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
Routes,
MemoryRouter,
useLocation,
} from 'react-router-dom';
} from 'react-router';

const breadcrumbNameMap = {
'/inbox': 'Inbox',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
Routes,
MemoryRouter,
useLocation,
} from 'react-router-dom';
} from 'react-router';

interface ListItemLinkProps extends ListItemProps {
to: string;
Expand Down
2 changes: 1 addition & 1 deletion docs/data/material/components/pagination/PaginationLink.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Link, MemoryRouter, Route, Routes, useLocation } from 'react-router-dom';
import { Link, MemoryRouter, Route, Routes, useLocation } from 'react-router';
import Pagination from '@mui/material/Pagination';
import PaginationItem from '@mui/material/PaginationItem';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Link, MemoryRouter, Route, Routes, useLocation } from 'react-router-dom';
import { Link, MemoryRouter, Route, Routes, useLocation } from 'react-router';
import Pagination from '@mui/material/Pagination';
import PaginationItem from '@mui/material/PaginationItem';

Expand Down
6 changes: 3 additions & 3 deletions docs/data/material/guides/composition/composition.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ This pattern is very powerful and allows for great flexibility, as well as a way

### Passing other React components

You can pass any other React component to `component` prop. For example, you can pass `Link` component from `react-router-dom`:
You can pass any other React component to `component` prop. For example, you can pass `Link` component from `react-router`:

```tsx
import { Link } from 'react-router-dom';
import { Link } from 'react-router';
import Button from '@mui/material/Button';

function Demo() {
Expand Down Expand Up @@ -84,7 +84,7 @@ Now the `CustomComponent` can be used with a `component` prop which should be se
In addition, the `CustomComponent` will have all props of a `<a>` HTML element.
The other props of the `Typography` component will also be present in props of the `CustomComponent`.

You can find a code example with the Button and react-router-dom in [these demos](/material-ui/integrations/routing/#component-prop).
You can find a code example with the Button and react-router in [these demos](/material-ui/integrations/routing/#component-prop).

### Generic

Expand Down
3 changes: 1 addition & 2 deletions docs/data/material/integrations/routing/ButtonRouter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import { Link as RouterLink, MemoryRouter } from 'react-router-dom';
import { StaticRouter } from 'react-router-dom/server';
import { Link as RouterLink, MemoryRouter, StaticRouter } from 'react-router';
import Button from '@mui/material/Button';

const LinkBehavior = React.forwardRef((props, ref) => (
Expand Down
4 changes: 2 additions & 2 deletions docs/data/material/integrations/routing/ButtonRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {
Link as RouterLink,
LinkProps as RouterLinkProps,
MemoryRouter,
} from 'react-router-dom';
import { StaticRouter } from 'react-router-dom/server';
StaticRouter,
} from 'react-router';
import Button from '@mui/material/Button';

const LinkBehavior = React.forwardRef<any, Omit<RouterLinkProps, 'to'>>(
Expand Down
3 changes: 1 addition & 2 deletions docs/data/material/integrations/routing/LinkRouter.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* eslint-disable jsx-a11y/anchor-is-valid */
import * as React from 'react';
import PropTypes from 'prop-types';
import { Link as RouterLink, MemoryRouter } from 'react-router-dom';
import { StaticRouter } from 'react-router-dom/server';
import { Link as RouterLink, MemoryRouter, StaticRouter } from 'react-router';
import Link from '@mui/material/Link';
import Box from '@mui/material/Box';

Expand Down
4 changes: 2 additions & 2 deletions docs/data/material/integrations/routing/LinkRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
Link as RouterLink,
LinkProps as RouterLinkProps,
MemoryRouter,
} from 'react-router-dom';
import { StaticRouter } from 'react-router-dom/server';
StaticRouter,
} from 'react-router';
import Link from '@mui/material/Link';
import Box from '@mui/material/Box';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import { Link as RouterLink, MemoryRouter } from 'react-router-dom';
import { StaticRouter } from 'react-router-dom/server';
import { Link as RouterLink, MemoryRouter, StaticRouter } from 'react-router';
import { ThemeProvider, createTheme } from '@mui/material/styles';
import Button from '@mui/material/Button';
import Stack from '@mui/material/Stack';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {
Link as RouterLink,
LinkProps as RouterLinkProps,
MemoryRouter,
} from 'react-router-dom';
import { StaticRouter } from 'react-router-dom/server';
StaticRouter,
} from 'react-router';
import { ThemeProvider, createTheme } from '@mui/material/styles';
import Button from '@mui/material/Button';
import Stack from '@mui/material/Stack';
Expand Down
10 changes: 8 additions & 2 deletions docs/data/material/integrations/routing/ListRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@ import Divider from '@mui/material/Divider';
import InboxIcon from '@mui/icons-material/Inbox';
import DraftsIcon from '@mui/icons-material/Drafts';
import Typography from '@mui/material/Typography';
import { Link, Route, Routes, MemoryRouter, useLocation } from 'react-router-dom';
import { StaticRouter } from 'react-router-dom/server';
import {
Link,
Route,
Routes,
MemoryRouter,
useLocation,
StaticRouter,
} from 'react-router';

function Router(props) {
const { children } = props;
Expand Down
10 changes: 8 additions & 2 deletions docs/data/material/integrations/routing/ListRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@ import Divider from '@mui/material/Divider';
import InboxIcon from '@mui/icons-material/Inbox';
import DraftsIcon from '@mui/icons-material/Drafts';
import Typography from '@mui/material/Typography';
import { Link, Route, Routes, MemoryRouter, useLocation } from 'react-router-dom';
import { StaticRouter } from 'react-router-dom/server';
import {
Link,
Route,
Routes,
MemoryRouter,
useLocation,
StaticRouter,
} from 'react-router';

function Router(props: { children?: React.ReactNode }) {
const { children } = props;
Expand Down
4 changes: 2 additions & 2 deletions docs/data/material/integrations/routing/TabsRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
Link,
matchPath,
useLocation,
} from 'react-router-dom';
import { StaticRouter } from 'react-router-dom/server';
StaticRouter,
} from 'react-router';

function Router(props) {
const { children } = props;
Expand Down
4 changes: 2 additions & 2 deletions docs/data/material/integrations/routing/TabsRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
Link,
matchPath,
useLocation,
} from 'react-router-dom';
import { StaticRouter } from 'react-router-dom/server';
StaticRouter,
} from 'react-router';

function Router(props: { children?: React.ReactNode }) {
const { children } = props;
Expand Down
6 changes: 3 additions & 3 deletions docs/data/material/integrations/routing/routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The Material UI theme lets you configure this component once.
For instance, with react-router:

```tsx
import { Link as RouterLink, LinkProps as RouterLinkProps } from 'react-router-dom';
import { Link as RouterLink, LinkProps as RouterLinkProps } from 'react-router';
import { LinkProps } from '@mui/material/Link';

const LinkBehavior = React.forwardRef<
Expand Down Expand Up @@ -65,9 +65,9 @@ In the event you need to provide a richer structure, see the next section.
You can achieve the integration with third-party routing libraries with the `component` prop.
You can learn more about this prop in the **[composition guide](/material-ui/guides/composition/#component-prop)**.

## react-router examples
## React Router examples

Here are a few demos with [react-router](https://github.com/remix-run/react-router).
Here are a few demos with the [Link component](https://reactrouter.com/start/library/navigating#link) of [React Router](https://github.com/remix-run/react-router).
You can apply the same strategy with all the components: BottomNavigation, Card, etc.

### Link
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"react-intersection-observer": "^9.13.1",
"react-is": "^18.3.1",
"react-number-format": "^5.4.2",
"react-router-dom": "^6.28.0",
"react-router": "^7.0.1",
"react-runner": "^1.0.5",
"react-simple-code-editor": "^0.14.1",
"react-spring": "^9.7.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-material/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"playwright": "^1.48.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.28.0",
"react-router": "^7.0.1",
"sinon": "^19.0.2"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-material/src/Button/Button.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Link as ReactRouterLink, LinkProps } from 'react-router-dom';
import { Link as ReactRouterLink, LinkProps } from 'react-router';
import { expectType } from '@mui/types';
import Button, { ButtonProps } from '@mui/material/Button';
import MaterialUiLink, { LinkProps as MaterialUiLinkProps } from '@mui/material/Link';
Expand Down
54 changes: 45 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1f3d69a

Please sign in to comment.