mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-02-09 22:35:54 -05:00
## Changes 🏗️ <img width="900" height="327" alt="Screenshot 2025-07-10 at 20 12 38" src="https://github.com/user-attachments/assets/044f00ed-7e05-46b7-a821-ce1cb0ee9298" /> <br /><br /> Navbar updated to look pretty from the new designs: - the logo is now centred instead of on the left - menu items have been updated to a smaller font-size and less radius - icons have been updated I also generated the API files ( _sorry for the noise_ ). I had to do some border-radius and button updates on the atoms/tokens for it to look good. ## Checklist 📋 ## For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: - [x] Login/logout - [x] The new navbar looks good across screens ## For configuration changes No config changes
92 lines
2.2 KiB
TypeScript
92 lines
2.2 KiB
TypeScript
import { cn } from "@/lib/utils";
|
|
import { CircleNotchIcon } from "@phosphor-icons/react/dist/ssr";
|
|
import Link, { type LinkProps } from "next/link";
|
|
import React from "react";
|
|
import { ButtonProps, extendedButtonVariants } from "./helpers";
|
|
|
|
export function Button(props: ButtonProps) {
|
|
const {
|
|
className,
|
|
variant,
|
|
size,
|
|
loading = false,
|
|
leftIcon,
|
|
rightIcon,
|
|
children,
|
|
as = "button",
|
|
...restProps
|
|
} = props;
|
|
|
|
const disabled = "disabled" in props ? props.disabled : false;
|
|
const isDisabled = disabled;
|
|
|
|
const buttonContent = (
|
|
<>
|
|
{loading && (
|
|
<CircleNotchIcon className="h-4 w-4 animate-spin" weight="bold" />
|
|
)}
|
|
{!loading && leftIcon}
|
|
{children}
|
|
{!loading && rightIcon}
|
|
</>
|
|
);
|
|
|
|
if (loading) {
|
|
const loadingClassName =
|
|
variant === "ghost"
|
|
? cn(
|
|
extendedButtonVariants({ variant, size, className }),
|
|
"pointer-events-none",
|
|
)
|
|
: cn(
|
|
extendedButtonVariants({ variant: "primary", size, className }),
|
|
"pointer-events-none border-zinc-500 bg-zinc-500 text-white",
|
|
);
|
|
|
|
return as === "NextLink" ? (
|
|
<Link
|
|
{...(restProps as LinkProps)}
|
|
className={loadingClassName}
|
|
aria-disabled="true"
|
|
>
|
|
<CircleNotchIcon className="h-4 w-4 animate-spin" weight="bold" />
|
|
{children}
|
|
</Link>
|
|
) : (
|
|
<button className={loadingClassName} disabled>
|
|
<CircleNotchIcon className="h-4 w-4 animate-spin" weight="bold" />
|
|
{children}
|
|
</button>
|
|
);
|
|
}
|
|
|
|
if (as === "NextLink") {
|
|
return (
|
|
<Link
|
|
{...(restProps as LinkProps)}
|
|
className={cn(
|
|
extendedButtonVariants({ variant, size, className }),
|
|
loading && "pointer-events-none",
|
|
isDisabled && "pointer-events-none opacity-50",
|
|
)}
|
|
aria-disabled={isDisabled}
|
|
>
|
|
{buttonContent}
|
|
</Link>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<button
|
|
className={cn(
|
|
extendedButtonVariants({ variant, size, className }),
|
|
loading && "pointer-events-none",
|
|
)}
|
|
disabled={isDisabled}
|
|
{...(restProps as React.ButtonHTMLAttributes<HTMLButtonElement>)}
|
|
>
|
|
{buttonContent}
|
|
</button>
|
|
);
|
|
}
|