core-components: fix Link stories

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-08-30 11:57:56 +02:00
parent ff51cdc4e6
commit 2ec30a0d4c
2 changed files with 14 additions and 9 deletions
@@ -44,7 +44,7 @@ const LinkWrapper = React.forwardRef<any, LinkProps>((props, ref) => (
* @public
* @remarks
*
* Makes the Button to utilise react-router
* Makes the Button to utilize react-router
*/
export const Button = React.forwardRef<any, ButtonProps>((props, ref) => (
<MaterialButton ref={ref} component={LinkWrapper} {...props} />
@@ -15,7 +15,12 @@
*/
import React, { ComponentType } from 'react';
import { Link } from './Link';
import { Route, useLocation, NavLink as RouterNavLink } from 'react-router-dom';
import {
Route,
useLocation,
NavLink as RouterNavLink,
Routes,
} from 'react-router-dom';
import { createRouteRef, useRouteRef } from '@backstage/core-plugin-api';
import { wrapInTestApp } from '@backstage/test-utils';
@@ -50,11 +55,11 @@ export const Default = () => {
return (
<>
<Link to={link()}>This link</Link>&nbsp;will utilise the react-router
<Link to={link()}>This link</Link>&nbsp;will utilize the react-router
MemoryRouter's navigation
<Route path={link()}>
<h1>Hi there!</h1>
</Route>
<Routes>
<Route path={link()} element={<h1>Hi there!</h1>} />
</Routes>
</>
);
};
@@ -75,9 +80,9 @@ export const PassProps = () => {
</Link>
&nbsp;has props for both material-ui's component as well as for
react-router-dom's
<Route path={link()}>
<h1>Hi there!</h1>
</Route>
<Routes>
<Route path={link()} element={<h1>Hi there!</h1>} />
</Routes>
</>
);
};