![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/lavocat.quebec/private_html/src/components/ui/ |
import React from 'react';
import { cn } from '@/lib/utils';
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
variant?: 'default' | 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'outline' | 'ghost';
size?: 'sm' | 'md' | 'lg';
children: React.ReactNode;
className?: string;
loading?: boolean;
}
const Button: React.FC<ButtonProps> = ({
variant = 'default',
size = 'md',
children,
className = '',
loading = false,
disabled,
...props
}) => {
const baseClasses = 'inline-flex items-center justify-center font-medium transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed';
const variantClasses = {
default: 'bg-gray-100 hover:bg-gray-200 text-gray-700 focus:ring-gray-500',
primary: 'bg-blue-600 hover:bg-blue-700 text-white focus:ring-blue-500',
secondary: 'bg-gray-600 hover:bg-gray-700 text-white focus:ring-gray-500',
success: 'bg-green-600 hover:bg-green-700 text-white focus:ring-green-500',
danger: 'bg-red-600 hover:bg-red-700 text-white focus:ring-red-500',
warning: 'bg-yellow-600 hover:bg-yellow-700 text-white focus:ring-yellow-500',
outline: 'bg-transparent border border-gray-300 hover:bg-gray-50 text-gray-700 focus:ring-gray-500',
ghost: 'bg-transparent hover:bg-gray-100 text-gray-700 focus:ring-gray-500'
};
const sizeClasses = {
sm: 'px-3 py-1.5 text-sm rounded',
md: 'px-4 py-2 rounded-lg',
lg: 'px-6 py-3 text-lg rounded-lg'
};
const classes = cn(
baseClasses,
variantClasses[variant],
sizeClasses[size],
className
);
return (
<button
className={classes}
disabled={disabled || loading}
{...props}
>
{loading && (
<svg className="animate-spin -ml-1 mr-2 h-4 w-4" fill="none" viewBox="0 0 24 24">
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4"></circle>
<path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
)}
{children}
</button>
);
};
export { Button };