import type { ButtonHTMLAttributes } from "react";
import { forwardRef } from "react";
type Variant = "default" | "primary" | "secondary" | "danger" | "ghost";
type Size = "sm" | "md" | "lg";
interface Props extends ButtonHTMLAttributes {
variant?: Variant;
size?: Size;
loading?: boolean;
}
const base =
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm font-semibold transition-all duration-150 active:scale-[0.98] disabled:cursor-not-allowed disabled:opacity-50";
const variants: Record = {
default:
"border border-border-subtle bg-white/5 text-text-primary hover:border-border-default hover:bg-white/[0.08]",
primary:
"bg-primary text-white shadow-[0_0_24px_rgb(var(--brand-accent-rgb)/0.18)] hover:bg-primary-hover",
secondary:
"border border-border-subtle bg-transparent text-text-secondary hover:border-border-default hover:bg-bg-hover hover:text-text-primary",
danger:
"border border-destructive/30 bg-destructive/10 text-destructive hover:bg-destructive/15",
ghost:
"bg-transparent text-text-secondary hover:bg-bg-hover hover:text-text-primary",
};
const sizes: Record = {
sm: "px-3 py-1.5 text-xs",
md: "px-3.5 py-2 text-sm",
lg: "px-5 py-2.5 text-base",
};
// Spinner sizes match button text sizes
const spinnerSizes: Record = {
sm: "h-3 w-3",
md: "h-4 w-4",
lg: "h-5 w-5",
};
function Spinner({ size }: { size: Size }) {
return (
);
}
const Button = forwardRef(
(
{
variant = "default",
size = "md",
loading = false,
className = "",
children,
disabled,
...props
},
ref,
) => {
return (
);
},
);
Button.displayName = "Button";
export default Button;