diff --git a/app/auth/sign-up/page.tsx b/app/auth/sign-up/page.tsx index d5dca78..1cba8b2 100644 --- a/app/auth/sign-up/page.tsx +++ b/app/auth/sign-up/page.tsx @@ -1,11 +1,27 @@ import { SignUpForm } from "@/components/sign-up-form"; +import { Suspense } from "react"; -export default function Page() { +export default function Page({ + searchParams, +}: { + searchParams: Promise<{ email?: string }>; +}) { return (
- + + +
); } + +async function SignUpFormContent({ + searchParams, +}: { + searchParams: Promise<{ email?: string }>; +}) { + const email = (await searchParams).email || ""; + return ; +} diff --git a/components/sign-up-form.tsx b/components/sign-up-form.tsx index 6c4b369..f558c9c 100644 --- a/components/sign-up-form.tsx +++ b/components/sign-up-form.tsx @@ -18,9 +18,10 @@ import { useState } from "react"; export function SignUpForm({ className, + initialEmail = "", ...props -}: React.ComponentPropsWithoutRef<"div">) { - const [email, setEmail] = useState(""); +}: React.ComponentPropsWithoutRef<"div"> & { initialEmail?: string }) { + const [email, setEmail] = useState(initialEmail); const [password, setPassword] = useState(""); const [repeatPassword, setRepeatPassword] = useState(""); const [error, setError] = useState(null); @@ -75,6 +76,8 @@ export function SignUpForm({ required value={email} onChange={(e) => setEmail(e.target.value)} + readOnly={!!initialEmail} + className={initialEmail ? "bg-muted text-muted-foreground" : ""} />