mirror of
https://github.com/neynarxyz/create-farcaster-mini-app.git
synced 2025-11-15 23:58:56 -05:00
This reverts commit b1fdfc19a92241638692d58494f48ce1bb25df74, reversing changes made to b9e2087bd8cd9e8ed7a5862936609b5bf29aa911.
55 lines
1.1 KiB
TypeScript
55 lines
1.1 KiB
TypeScript
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
children: React.ReactNode;
|
|
isLoading?: boolean;
|
|
variant?: 'primary' | 'secondary' | 'outline';
|
|
size?: 'sm' | 'md' | 'lg';
|
|
}
|
|
|
|
export function Button({
|
|
children,
|
|
className = "",
|
|
isLoading = false,
|
|
variant = 'primary',
|
|
size = 'md',
|
|
...props
|
|
}: ButtonProps) {
|
|
const baseClasses = "btn";
|
|
|
|
const variantClasses = {
|
|
primary: "btn-primary",
|
|
secondary: "btn-secondary",
|
|
outline: "btn-outline"
|
|
};
|
|
|
|
const sizeClasses = {
|
|
sm: "px-3 py-1.5 text-xs",
|
|
md: "px-4 py-2 text-sm",
|
|
lg: "px-6 py-3 text-base"
|
|
};
|
|
|
|
const fullWidthClasses = "w-full max-w-xs mx-auto block";
|
|
|
|
const combinedClasses = [
|
|
baseClasses,
|
|
variantClasses[variant],
|
|
sizeClasses[size],
|
|
fullWidthClasses,
|
|
className
|
|
].join(' ');
|
|
|
|
return (
|
|
<button
|
|
className={combinedClasses}
|
|
{...props}
|
|
>
|
|
{isLoading ? (
|
|
<div className="flex items-center justify-center">
|
|
<div className="spinner-primary h-5 w-5" />
|
|
</div>
|
|
) : (
|
|
children
|
|
)}
|
|
</button>
|
|
);
|
|
}
|