2025-12-03 21:56:50 +00:00
|
|
|
import React from 'react';
|
|
|
|
|
import { cn } from '@/lib/utils';
|
|
|
|
|
|
|
|
|
|
interface AuthButtonProps
|
|
|
|
|
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
|
|
loading?: boolean;
|
|
|
|
|
variant?: 'primary' | 'secondary';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function AuthButton({
|
|
|
|
|
loading,
|
|
|
|
|
variant = 'primary',
|
|
|
|
|
className,
|
|
|
|
|
children,
|
|
|
|
|
disabled,
|
|
|
|
|
...props
|
|
|
|
|
}: AuthButtonProps) {
|
|
|
|
|
return (
|
|
|
|
|
<button
|
|
|
|
|
className={cn(
|
2026-02-12 01:09:29 +00:00
|
|
|
'w-full px-4 py-2.5 rounded-xl font-medium transition-all duration-[var(--sumi-duration-slow)] ease-in-out focus:outline-none focus:ring-2 focus:ring-primary/20 focus:ring-offset-2 focus:ring-offset-background',
|
2025-12-03 21:56:50 +00:00
|
|
|
variant === 'primary'
|
2026-02-12 01:09:29 +00:00
|
|
|
? 'bg-primary text-primary-foreground hover:opacity-90 shadow-sm'
|
2026-02-07 18:52:12 +00:00
|
|
|
: 'bg-muted text-foreground hover:bg-muted/80 border border-border',
|
2025-12-03 21:56:50 +00:00
|
|
|
(disabled || loading) && 'opacity-50 cursor-not-allowed',
|
2025-12-13 02:34:34 +00:00
|
|
|
className,
|
2025-12-03 21:56:50 +00:00
|
|
|
)}
|
|
|
|
|
disabled={disabled || loading}
|
|
|
|
|
aria-busy={loading}
|
|
|
|
|
aria-disabled={disabled || loading ? 'true' : 'false'}
|
|
|
|
|
{...props}
|
|
|
|
|
>
|
|
|
|
|
{loading ? (
|
|
|
|
|
<>
|
|
|
|
|
<span className="sr-only">Chargement en cours</span>
|
|
|
|
|
<span aria-hidden="true">Chargement...</span>
|
|
|
|
|
</>
|
|
|
|
|
) : (
|
|
|
|
|
children
|
|
|
|
|
)}
|
|
|
|
|
</button>
|
|
|
|
|
);
|
|
|
|
|
}
|