Browse Source

fixed tsc errors

pull/649/head
Dan Ditomaso 1 year ago
parent
commit
23c75a34ee
  1. 2
      src/components/PageComponents/Messages/TraceRoute.test.tsx
  2. 70
      src/components/UI/Button.tsx
  3. 6
      src/components/UI/Typography/Link.tsx
  4. 4
      src/pages/Nodes/index.tsx

2
src/components/PageComponents/Messages/TraceRoute.test.tsx

@ -104,10 +104,8 @@ describe("TraceRoute", () => {
/>,
);
// Check for the translated title
expect(screen.getByText("Route back:")).toBeInTheDocument();
// With route back, both names appear twice
expect(screen.getAllByText("Source Node")).toHaveLength(2);
expect(screen.getAllByText("Destination Node")).toHaveLength(2);

70
src/components/UI/Button.tsx

@ -46,44 +46,36 @@ export interface ButtonProps
iconAlignment?: "left" | "right";
}
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
(
{
className,
variant,
size,
disabled,
icon,
iconAlignment = "left",
children,
...props
},
ref,
) => {
return (
<button
type="button"
className={cn(
buttonVariants({ variant, size, className }),
{ "cursor-not-allowed": disabled },
"inline-flex items-center",
)}
ref={ref}
disabled={disabled}
{...props}
>
{icon && iconAlignment === "left" && (
<span className={cn({ "mr-2": !!children })}>{icon}</span>
)}
{children}
{icon && iconAlignment === "right" && (
<span className={cn({ "ml-2": !!children })}>{icon}</span>
)}
</button>
);
},
);
Button.displayName = "Button";
const Button = ({
className,
variant,
size,
disabled,
icon,
iconAlignment = "left",
children,
...props
}: ButtonProps) => {
return (
<button
type="button"
className={cn(
buttonVariants({ variant, size, className }),
{ "cursor-not-allowed": disabled },
"inline-flex items-center",
)}
disabled={disabled}
{...props}
>
{icon && iconAlignment === "left" && (
<span className={cn({ "mr-2": !!children })}>{icon}</span>
)}
{children}
{icon && iconAlignment === "right" && (
<span className={cn({ "ml-2": !!children })}>{icon}</span>
)}
</button>
);
};
export { Button, buttonVariants };

6
src/components/UI/Typography/Link.tsx

@ -6,7 +6,11 @@ import {
export interface LinkProps extends RouterLinkProps {
href: string;
children?: React.ReactNode;
children?:
| React.ReactNode
| ((
state: { isActive: boolean; isTransitioning: boolean },
) => React.ReactNode);
className?: string;
}

4
src/pages/Nodes/index.tsx

@ -1,5 +1,5 @@
import { LocationResponseDialog } from "@app/components/Dialog/LocationResponseDialog.tsx";
import { TracerouteResponseDialog } from "@app/components/Dialog/TracerouteResponseDialog.tsx";
import { LocationResponseDialog } from "@components/Dialog/LocationResponseDialog.tsx";
import { TracerouteResponseDialog } from "@components/Dialog/TracerouteResponseDialog.tsx";
import { Sidebar } from "@components/Sidebar.tsx";
import { Avatar } from "@components/UI/Avatar.tsx";
import { Mono } from "@components/generic/Mono.tsx";

Loading…
Cancel
Save