feat: add sign in button with progress states

This commit is contained in:
rajun 2026-10-27 16:28:56 +05:30
parent 7e3f875f35
commit 02259df5d3

View File

@ -0,0 +1,22 @@
import { ArrowRight, Loader2 } from 'lucide-react';
import { Button } from '~/components/ui/button';
import { BRAND } from '~/data/brand';
export type SignInState = 'idle' | 'busy' | 'done';
const LABELS: Record<SignInState, string> = {
idle: 'Sign in',
busy: 'Signing in…',
done: `Signed in. Opening ${BRAND.product}`,
};
export function SignInButton({ state }: { state: SignInState }) {
const working = state !== 'idle';
return (
<Button type='submit' size='xl' variant={state === 'done' ? 'success' : 'default'} disabled={working} aria-busy={working} className='group w-full'>
{state === 'busy' && <Loader2 size={16} className='animate-spin' />}
{LABELS[state]}
{state === 'idle' && <ArrowRight size={15} className='transition-transform group-hover:translate-x-0.5' />}
</Button>
);
}