diff --git a/app/globals.css b/app/globals.css index 06cbc06..95296a6 100644 --- a/app/globals.css +++ b/app/globals.css @@ -936,9 +936,15 @@ html[data-route-scope='drive'] body { } } +.ultimail-login-connect-action { + display: flex; + width: 100%; + justify-content: center; +} + .ultimail-login .ultimail-login-connect-border { position: relative; - display: inline-flex; + display: flex; width: 100%; padding: 2px; border-radius: 9999px; @@ -1163,6 +1169,11 @@ html[data-route-scope='drive'] body { .ultimail-login .ultimail-login-connect-border { width: auto; } + + .ultimail-login-connect-action .ultimail-login-connect-border, + .ultimail-login-card-frame .ultimail-login-connect-border { + width: 100%; + } } @media (prefers-reduced-motion: reduce) { diff --git a/components/auth/auth-connect-button.tsx b/components/auth/auth-connect-button.tsx new file mode 100644 index 0000000..2370cc3 --- /dev/null +++ b/components/auth/auth-connect-button.tsx @@ -0,0 +1,66 @@ +"use client" + +import Link from "next/link" +import { cn } from "@/lib/utils" + +type AuthConnectButtonCommon = { + children: React.ReactNode + className?: string +} + +type AuthConnectButtonAsButton = AuthConnectButtonCommon & + React.ButtonHTMLAttributes & { + href?: undefined + } + +type AuthConnectButtonAsAnchor = AuthConnectButtonCommon & + React.AnchorHTMLAttributes & { + href: string + } + +type AuthConnectButtonAsLink = AuthConnectButtonCommon & + Omit, "href"> & { + href: string + as: "link" + } + +export type AuthConnectButtonProps = + | AuthConnectButtonAsButton + | AuthConnectButtonAsAnchor + | AuthConnectButtonAsLink + +/** UltiSpace gradient CTA — full width, centered in auth flows. */ +export function AuthConnectButton(props: AuthConnectButtonProps) { + const { children, className } = props + const btnClass = cn("ultimail-login-connect-btn w-full", className) + + let control: React.ReactNode + if ("as" in props && props.as === "link") { + const { as: _as, href, className: _c, children: _ch, ...linkProps } = props + control = ( + + {children} + + ) + } else if ("href" in props && props.href) { + const { href, className: _c, children: _ch, ...anchorProps } = props + control = ( + + {children} + + ) + } else { + const { className: _c, children: _ch, ...buttonProps } = props + control = ( + + ) + } + + return ( +
+
{control}
+
+ ) +} diff --git a/components/auth/auth-flow-page.tsx b/components/auth/auth-flow-page.tsx index 9f0b829..de337b7 100644 --- a/components/auth/auth-flow-page.tsx +++ b/components/auth/auth-flow-page.tsx @@ -1,9 +1,9 @@ "use client" import { useCallback, useEffect, useMemo, useState } from "react" -import Link from "next/link" import { Loader2 } from "lucide-react" import { AuthCard } from "@/components/auth/auth-card" +import { AuthConnectButton } from "@/components/auth/auth-connect-button" import { FlowChallengeForm } from "@/components/auth/flow-challenge-form" import { AUTH_FLOW_SLUGS, @@ -131,17 +131,15 @@ export function AuthFlowPage({ Redirection en cours…

) : null} -
- {successExternal ? ( - - {successActionLabel} - - ) : ( - - {successActionLabel} - - )} -
+ {successExternal ? ( + + {successActionLabel} + + ) : ( + + {successActionLabel} + + )} ) : ( - - + + {submitting ? ( + <> + + Patientez… + + ) : ( + primaryAction + )} + ) : null} ) diff --git a/components/auth/login-form.tsx b/components/auth/login-form.tsx index c5101c1..e3b48f5 100644 --- a/components/auth/login-form.tsx +++ b/components/auth/login-form.tsx @@ -1,8 +1,8 @@ "use client" -import Link from "next/link" import { Sparkles } from "lucide-react" import { AuthCard } from "@/components/auth/auth-card" +import { AuthConnectButton } from "@/components/auth/auth-connect-button" type LoginFormProps = { loginHref: string @@ -25,26 +25,22 @@ export function LoginForm({

Pas encore de compte ?{" "} - + Créer un compte - +

- + Mot de passe oublié ? - +

} > -
- -
+ + + Se connecter avec UltiSpace + ) }