diff --git a/.changeset/fair-falcons-scream.md b/.changeset/fair-falcons-scream.md new file mode 100644 index 0000000000..1f2f095c81 --- /dev/null +++ b/.changeset/fair-falcons-scream.md @@ -0,0 +1,7 @@ +--- +'@backstage/core-components': patch +'@backstage/plugin-explore': patch +--- + +- Enhanced core `Button` component to open external links in new tab. +- Replaced the use of `Button` component from material by `core-components` in tools card. diff --git a/packages/core-components/src/components/Link/Link.tsx b/packages/core-components/src/components/Link/Link.tsx index dd169390a5..7853c4f52f 100644 --- a/packages/core-components/src/components/Link/Link.tsx +++ b/packages/core-components/src/components/Link/Link.tsx @@ -37,9 +37,16 @@ export type LinkProps = MaterialLinkProps & */ export const Link = React.forwardRef((props, ref) => { const to = String(props.to); - return isExternalUri(to) ? ( + const external = isExternalUri(to); + const newWindow = external && !!/^https?:/.exec(to); + return external ? ( // External links - + ) : ( // Interact with React Router for internal links diff --git a/plugins/explore/src/components/ToolCard/ToolCard.tsx b/plugins/explore/src/components/ToolCard/ToolCard.tsx index 2baa0cffda..904db0c00b 100644 --- a/plugins/explore/src/components/ToolCard/ToolCard.tsx +++ b/plugins/explore/src/components/ToolCard/ToolCard.tsx @@ -18,7 +18,6 @@ import { ExploreTool } from '@backstage/plugin-explore-react'; import { BackstageTheme } from '@backstage/theme'; import { Box, - Button, Card, CardActions, CardContent, @@ -27,6 +26,7 @@ import { makeStyles, Typography, } from '@material-ui/core'; +import { Button } from '@backstage/core-components'; import classNames from 'classnames'; import React from 'react'; @@ -97,7 +97,7 @@ export const ToolCard = ({ card, objectFit }: Props) => { )} - diff --git a/plugins/git-release-manager/src/features/Features.test.tsx b/plugins/git-release-manager/src/features/Features.test.tsx index ac3004f690..b5404a21d9 100644 --- a/plugins/git-release-manager/src/features/Features.test.tsx +++ b/plugins/git-release-manager/src/features/Features.test.tsx @@ -69,6 +69,7 @@ describe('Features', () => {