- AUTH-014: Fix theme storage key (jarvis-theme -> mosaic-theme) - AUTH-016: Create AuthDivider component with customizable text - AUTH-019: Create SessionExpiryWarning floating banner (PDA-friendly, blue) - Fix lint errors in LoginForm, OAuthButton from parallel agents - Sync pnpm-lock.yaml for recharts dependency Refs #415 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
50 lines
1.2 KiB
TypeScript
50 lines
1.2 KiB
TypeScript
"use client";
|
|
|
|
import type { ReactElement } from "react";
|
|
import { Loader2 } from "lucide-react";
|
|
|
|
export interface OAuthButtonProps {
|
|
providerName: string;
|
|
providerId: string;
|
|
onClick: () => void;
|
|
isLoading?: boolean;
|
|
disabled?: boolean;
|
|
}
|
|
|
|
export function OAuthButton({
|
|
providerName,
|
|
onClick,
|
|
isLoading = false,
|
|
disabled = false,
|
|
}: OAuthButtonProps): ReactElement {
|
|
const isDisabled = disabled || isLoading;
|
|
|
|
return (
|
|
<button
|
|
type="button"
|
|
role="button"
|
|
onClick={onClick}
|
|
disabled={isDisabled}
|
|
aria-label={isLoading ? "Connecting" : `Continue with ${providerName}`}
|
|
className={[
|
|
"w-full inline-flex items-center justify-center gap-2",
|
|
"rounded-md px-4 py-2 text-base font-medium",
|
|
"bg-blue-600 text-white hover:bg-blue-700",
|
|
"transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500",
|
|
isDisabled ? "opacity-50 pointer-events-none" : "",
|
|
]
|
|
.filter(Boolean)
|
|
.join(" ")}
|
|
>
|
|
{isLoading ? (
|
|
<>
|
|
<Loader2 className="h-4 w-4 animate-spin" aria-hidden="true" />
|
|
<span>Connecting...</span>
|
|
</>
|
|
) : (
|
|
<span>Continue with {providerName}</span>
|
|
)}
|
|
</button>
|
|
);
|
|
}
|