Browse Source

fixed tsc errors

pull/644/head
Dan Ditomaso 1 year ago
parent
commit
bd8b7ab5f1
  1. 1
      src/components/Form/FormSelect.tsx
  2. 2
      src/components/PageComponents/Messages/TraceRoute.test.tsx
  3. 70
      src/components/UI/Button.tsx
  4. 6
      src/components/UI/Typography/Link.tsx
  5. 4
      src/pages/Nodes/index.tsx

1
src/components/Form/FormSelect.tsx

@ -43,6 +43,7 @@ export function SelectInput<T extends FieldValues>({
} = useController({ } = useController({
name: field.name, name: field.name,
control, control,
defaultValue: field.properties.defaultValue,
}); });
const { enumValue, formatEnumName, defaultValue, ...remainingProperties } = const { enumValue, formatEnumName, defaultValue, ...remainingProperties } =

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(); expect(screen.getByText("Route back:")).toBeInTheDocument();
// With route back, both names appear twice
expect(screen.getAllByText("Source Node")).toHaveLength(2); expect(screen.getAllByText("Source Node")).toHaveLength(2);
expect(screen.getAllByText("Destination 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"; iconAlignment?: "left" | "right";
} }
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>( const Button = ({
( className,
{ variant,
className, size,
variant, disabled,
size, icon,
disabled, iconAlignment = "left",
icon, children,
iconAlignment = "left", ...props
children, }: ButtonProps) => {
...props return (
}, <button
ref, type="button"
) => { className={cn(
return ( buttonVariants({ variant, size, className }),
<button { "cursor-not-allowed": disabled },
type="button" "inline-flex items-center",
className={cn( )}
buttonVariants({ variant, size, className }), disabled={disabled}
{ "cursor-not-allowed": disabled }, {...props}
"inline-flex items-center", >
)} {icon && iconAlignment === "left" && (
ref={ref} <span className={cn({ "mr-2": !!children })}>{icon}</span>
disabled={disabled} )}
{...props} {children}
> {icon && iconAlignment === "right" && (
{icon && iconAlignment === "left" && ( <span className={cn({ "ml-2": !!children })}>{icon}</span>
<span className={cn({ "mr-2": !!children })}>{icon}</span> )}
)} </button>
{children} );
};
{icon && iconAlignment === "right" && (
<span className={cn({ "ml-2": !!children })}>{icon}</span>
)}
</button>
);
},
);
Button.displayName = "Button";
export { Button, buttonVariants }; export { Button, buttonVariants };

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

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

4
src/pages/Nodes/index.tsx

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

Loading…
Cancel
Save