Merge pull request #16453 from backstage/freben/linkbutton

Get rid of usages of the old Button
This commit is contained in:
Fredrik Adelöw
2023-02-22 16:01:56 +01:00
committed by GitHub
16 changed files with 59 additions and 43 deletions
@@ -24,7 +24,7 @@ import LaunchIcon from '@material-ui/icons/Launch';
import { useBuildWithSteps } from '../../state/useBuildWithSteps';
import {
Breadcrumbs,
Button,
LinkButton,
InfoCard,
Progress,
Link,
@@ -33,9 +33,9 @@ import {
const BuildName = ({ build }: { build?: BuildWithSteps }) => (
<Box display="flex" alignItems="center">
#{build?.build_num} - {build?.subject}
<Button to={build?.build_url || '#'}>
<LinkButton to={build?.build_url || '#'}>
<LaunchIcon />
</Button>
</LinkButton>
</Box>
);
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { useState } from 'react';
import { Content, Header, LinkButton, Page } from '@backstage/core-components';
import { EntityTextArea } from '../EntityTextArea';
@@ -31,7 +31,7 @@ import {
} from '@material-ui/core';
import React from 'react';
import { Button, ItemCardHeader } from '@backstage/core-components';
import { LinkButton, ItemCardHeader } from '@backstage/core-components';
import { useRouteRef } from '@backstage/core-plugin-api';
/** @public */
@@ -66,9 +66,9 @@ export const DomainCard = (props: { entity: DomainEntity }) => {
{entity.metadata.description}
</CardContent>
<CardActions>
<Button to={url} color="primary">
<LinkButton to={url} color="primary">
Explore
</Button>
</LinkButton>
</CardActions>
</Card>
);
@@ -26,7 +26,7 @@ import {
makeStyles,
Typography,
} from '@material-ui/core';
import { Button } from '@backstage/core-components';
import { LinkButton } from '@backstage/core-components';
import classNames from 'classnames';
import React from 'react';
@@ -97,9 +97,9 @@ export const ToolCard = ({ card, objectFit }: Props) => {
)}
</CardContent>
<CardActions>
<Button color="primary" to={url} disabled={!url}>
<LinkButton color="primary" to={url} disabled={!url}>
Explore
</Button>
</LinkButton>
</CardActions>
</Card>
);
@@ -33,7 +33,7 @@ import { V1ObjectMeta } from '@kubernetes/client-node';
import { withStyles } from '@material-ui/core/styles';
import jsYaml from 'js-yaml';
import {
Button as BackstageButton,
LinkButton as BackstageButton,
CodeSnippet,
StructuredMetadataTable,
WarningPanel,
@@ -15,8 +15,8 @@
*/
import {
Button,
ItemCardHeader,
LinkButton,
MarkdownContent,
} from '@backstage/core-components';
import { useRouteRef } from '@backstage/core-plugin-api';
@@ -118,13 +118,13 @@ export const PlaylistCard = ({ playlist }: PlaylistCardProps) => {
</Box>
</CardContent>
<CardActions>
<Button
<LinkButton
color="primary"
aria-label={`Choose ${playlist.name}`}
to={playlistRoute({ playlistId: playlist.id })}
>
Choose
</Button>
</LinkButton>
</CardActions>
</Card>
);
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
DEFAULT_NAMESPACE,
Entity,
@@ -22,9 +23,9 @@ import {
stringifyEntityRef,
} from '@backstage/catalog-model';
import {
Button,
ItemCardHeader,
Link,
LinkButton,
MarkdownContent,
} from '@backstage/core-components';
import {
@@ -291,13 +292,13 @@ export const TemplateCard = ({ template, deprecated }: TemplateCardProps) => {
</Tooltip>
))}
</div>
<Button
<LinkButton
color="primary"
to={href}
aria-label={`Choose ${templateProps.title}`}
>
Choose
</Button>
</LinkButton>
</CardActions>
</Card>
);
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import { Button } from '@backstage/core-components';
import { LinkButton } from '@backstage/core-components';
import { lightTheme } from '@backstage/theme';
import { Grid } from '@material-ui/core';
import CssBaseline from '@material-ui/core/CssBaseline';
@@ -66,7 +66,7 @@ export const WithSecondaryAction = () => {
<DefaultResultListItem
result={mockSearchResult}
secondaryAction={
<Button
<LinkButton
to="#"
size="small"
aria-label="owner"
@@ -75,7 +75,7 @@ export const WithSecondaryAction = () => {
style={{ textTransform: 'lowercase' }}
>
{mockSearchResult.owner}
</Button>
</LinkButton>
}
/>
);
@@ -19,7 +19,7 @@ import { toLowerMaybe } from '../../../helpers';
import { Entity } from '@backstage/catalog-model';
import { useApi, useRouteRef, configApiRef } from '@backstage/core-plugin-api';
import {
Button,
LinkButton,
ItemCardGrid,
ItemCardHeader,
} from '@backstage/core-components';
@@ -58,7 +58,7 @@ export const DocsCardGrid = (props: DocsCardGridProps) => {
</CardMedia>
<CardContent>{entity.metadata.description}</CardContent>
<CardActions>
<Button
<LinkButton
to={getRouteToReaderPageFor({
namespace: toLowerMaybe(
entity.metadata.namespace ?? 'default',
@@ -71,7 +71,7 @@ export const DocsCardGrid = (props: DocsCardGridProps) => {
data-testid="read_docs"
>
Read Docs
</Button>
</LinkButton>
</CardActions>
</Card>
))}
@@ -25,7 +25,7 @@ import {
} from '@backstage/plugin-catalog-react';
import { rootDocsRouteRef } from '../../../routes';
import {
Button,
LinkButton,
EmptyState,
Table,
TableColumn,
@@ -121,13 +121,13 @@ export const DocsTable = (props: DocsTableProps) => {
title="No documents to show"
description="Create your own document. Check out our Getting Started Information"
action={
<Button
<LinkButton
color="primary"
to="https://backstage.io/docs/features/techdocs/getting-started"
variant="contained"
>
DOCS
</Button>
</LinkButton>
}
/>
)}