From 66aebb04e87733e449e9b3eb9799fd293757d55d Mon Sep 17 00:00:00 2001 From: javayhu Date: Sun, 23 Feb 2025 14:25:23 +0800 Subject: [PATCH] refactor: update authentication layout and login page design --- src/app/auth/layout.tsx | 8 +- src/app/auth/login/page.tsx | 23 ++++- .../{reset-password => new-password}/page.tsx | 0 src/app/login/page.tsx | 19 ---- src/components/auth/auth-card.tsx | 6 +- src/components/auth/bottom-button.tsx | 5 +- src/components/auth/login-form.tsx | 10 +- src/components/login-form.tsx | 96 ------------------- 8 files changed, 37 insertions(+), 130 deletions(-) rename src/app/auth/{reset-password => new-password}/page.tsx (100%) delete mode 100644 src/app/login/page.tsx delete mode 100644 src/components/login-form.tsx diff --git a/src/app/auth/layout.tsx b/src/app/auth/layout.tsx index e511b0c..9788b20 100644 --- a/src/app/auth/layout.tsx +++ b/src/app/auth/layout.tsx @@ -3,8 +3,6 @@ import BackButtonSmall from "@/components/shared/back-button-small"; /** * auth layout is different from other public layouts, * so auth directory is not put in (public) directory. - * - * https://ui.shadcn.com/blocks#authentication-04 */ export default function AuthLayout({ children, @@ -12,9 +10,11 @@ export default function AuthLayout({ children: React.ReactNode; }) { return ( -
+
-
{children}
+
+ {children} +
); } diff --git a/src/app/auth/login/page.tsx b/src/app/auth/login/page.tsx index 183c561..60da576 100644 --- a/src/app/auth/login/page.tsx +++ b/src/app/auth/login/page.tsx @@ -9,7 +9,28 @@ export const metadata = constructMetadata({ }); const LoginPage = () => { - return ; + return ( +
+ +
+ By clicking continue, you agree to our{" "} + + Terms of Service + {" "} + and{" "} + + Privacy Policy + + . +
+
+ ); }; export default LoginPage; diff --git a/src/app/auth/reset-password/page.tsx b/src/app/auth/new-password/page.tsx similarity index 100% rename from src/app/auth/reset-password/page.tsx rename to src/app/auth/new-password/page.tsx diff --git a/src/app/login/page.tsx b/src/app/login/page.tsx deleted file mode 100644 index e7b21cd..0000000 --- a/src/app/login/page.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { GalleryVerticalEnd } from "lucide-react"; - -import { LoginForm } from "@/components/login-form"; - -export default function LoginPage() { - return ( -
-
- -
- -
- Acme Inc. -
- -
-
- ); -} diff --git a/src/components/auth/auth-card.tsx b/src/components/auth/auth-card.tsx index 0f4fe87..e3b259b 100644 --- a/src/components/auth/auth-card.tsx +++ b/src/components/auth/auth-card.tsx @@ -7,13 +7,11 @@ import { CardContent, CardDescription, CardFooter, - CardHeader, - CardTitle, + CardHeader } from "@/components/ui/card"; -import { siteConfig } from "@/config/site"; import { cn } from "@/lib/utils"; import Link from "next/link"; -import { Logo } from "../logo"; +import { Logo } from "@/components/logo"; interface AuthCardProps { children: React.ReactNode; diff --git a/src/components/auth/bottom-button.tsx b/src/components/auth/bottom-button.tsx index d63aab7..f91158e 100644 --- a/src/components/auth/bottom-button.tsx +++ b/src/components/auth/bottom-button.tsx @@ -1,7 +1,6 @@ "use client"; import { Button } from "@/components/ui/button"; -import Link from "next/link"; interface BottomButtonProps { href: string; @@ -16,7 +15,9 @@ export const BottomButton = ({ href, label }: BottomButtonProps) => { size="sm" asChild > - {label} + + {label} + ); }; diff --git a/src/components/auth/login-form.tsx b/src/components/auth/login-form.tsx index ffd52d5..30c6263 100644 --- a/src/components/auth/login-form.tsx +++ b/src/components/auth/login-form.tsx @@ -18,9 +18,8 @@ import { authClient } from "@/lib/auth-client"; import { LoginSchema } from "@/lib/schemas"; import { cn } from "@/lib/utils"; import { zodResolver } from "@hookform/resolvers/zod"; -import Link from "next/link"; import { useRouter, useSearchParams } from "next/navigation"; -import { useState, useTransition } from "react"; +import { useState } from "react"; import { useForm } from "react-hook-form"; import type * as z from "zod"; @@ -119,9 +118,12 @@ export const LoginForm = ({ className }: { className?: string }) => { asChild className="px-0 font-normal text-muted-foreground" > - + Forgot password? - +
diff --git a/src/components/login-form.tsx b/src/components/login-form.tsx deleted file mode 100644 index dbc52c0..0000000 --- a/src/components/login-form.tsx +++ /dev/null @@ -1,96 +0,0 @@ -import { cn } from "@/lib/utils" -import { Button } from "@/components/ui/button" -import { - Card, - CardContent, - CardDescription, - CardHeader, - CardTitle, -} from "@/components/ui/card" -import { Input } from "@/components/ui/input" -import { Label } from "@/components/ui/label" - -export function LoginForm({ - className, - ...props -}: React.ComponentPropsWithoutRef<"div">) { - return ( -
- - - Welcome back - - Login with your Apple or Google account - - - -
-
-
- - -
-
- - Or continue with - -
-
-
- - -
-
- - -
- -
-
- Don't have an account?{" "} - - Sign up - -
-
-
-
-
-
- By clicking continue, you agree to our Terms of Service{" "} - and Privacy Policy. -
-
- ) -}