Skip to content

Commit

Permalink
Replace Button from PF to a plain link with the Button's css classes …
Browse files Browse the repository at this point in the history
…applied (#481)
  • Loading branch information
riccardo-forina authored Feb 15, 2024
1 parent b280333 commit 6ce29e1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
7 changes: 2 additions & 5 deletions ui/app/[locale]/kafka/not-found.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,10 @@ export default function NotFound() {
headingLevel={"h1"}
icon={<EmptyStateIcon icon={PathMissingIcon} />}
/>
<EmptyStateBody>
The selected cluster is unavailable. Please check the connection and
try again.
</EmptyStateBody>
<EmptyStateBody>The selected cluster is unavailable.</EmptyStateBody>
<EmptyStateFooter>
<EmptyStateActions>
<ButtonLink href={"/resources"}>Check the connection</ButtonLink>
<ButtonLink href={"/"}>Back to the homepage</ButtonLink>
</EmptyStateActions>
</EmptyStateFooter>
</EmptyState>
Expand Down
9 changes: 6 additions & 3 deletions ui/components/ButtonLink.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
"use client";
import { Button, ButtonProps } from "@/libs/patternfly/react-core";
import { ButtonProps } from "@/libs/patternfly/react-core";
import { Link } from "@/navigation";
import { Route } from "next";

export function ButtonLink<T extends string>({
href,
...props
variant,
children,
}: ButtonProps & { href: Route<T> | URL }) {
return (
<Button {...props} component={(props) => <Link {...props} href={href} />} />
<Link className={`pf-v5-c-button pf-m-${variant}`} href={href}>
{children}
</Link>
);
}
3 changes: 1 addition & 2 deletions ui/components/table/ResponsiveTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -444,15 +444,14 @@ export const DeletableRow = memo<DeletableRowProps>(
({ isDeleted, isSelected, onClick, children, rowOuiaId }) => {
return (
<Tr
// isHoverable={!isDeleted && onClick !== undefined}
onRowClick={(e) => {
if (e?.target instanceof HTMLElement) {
if (!["a", "button"].includes(e.target.tagName.toLowerCase())) {
onClick && onClick();
}
}
}}
isClickable={!!onClick}
isClickable={!isDeleted && !!onClick}
isSelectable={!!onClick}
ouiaId={rowOuiaId}
isRowSelected={isSelected}
Expand Down

0 comments on commit 6ce29e1

Please sign in to comment.