/** * @file AuthCard.tsx * @description The card the signed-out screens share (the login page, the * first-login password change in `FirstPasswordPage.tsx`): a centred form * with the theme's accent glow and grid behind the brand logo, a title and a * subtitle. While it shows, the OS's light/dark applies (`applySystemTheme`), * since no account's theme has been chosen for it. * @author Nguyễn Ngọc Trí Vĩ */ import { useLayoutEffect, type FormEvent, type ReactNode } from "react"; import { BRAND_LOGO } from "../lib/brand"; import { applySystemTheme } from "../hooks/useTheme"; export function AuthCard({ title, subtitle, onSubmit, children, }: { title: string; subtitle: string; onSubmit: (e: FormEvent) => void; children: ReactNode; }) { // Follow the OS, live. useLayoutEffect(() => { applySystemTheme(); const mq = window.matchMedia?.("(prefers-color-scheme: dark)"); mq?.addEventListener?.("change", applySystemTheme); return () => mq?.removeEventListener?.("change", applySystemTheme); }, []); return (
{/* Accent glow and a grid fading out from the top, drawn from the theme's own accent so it holds in every theme. */}
SmartGift

{title}

{subtitle}

{children}
); }