From 72ace3e5d4fba4429ab94b99d74cd4d73f66d53e Mon Sep 17 00:00:00 2001 From: Rengarajan R Date: Tue, 31 Mar 2026 14:57:35 +0530 Subject: [PATCH] docs: redesign Next.js quickstart sample app UI --- main/docs/quickstart/webapp/nextjs/index.mdx | 170 ++++++++++--------- 1 file changed, 89 insertions(+), 81 deletions(-) diff --git a/main/docs/quickstart/webapp/nextjs/index.mdx b/main/docs/quickstart/webapp/nextjs/index.mdx index 9ecd4a7bb..ac68a505a 100644 --- a/main/docs/quickstart/webapp/nextjs/index.mdx +++ b/main/docs/quickstart/webapp/nextjs/index.mdx @@ -247,9 +247,9 @@ APP_BASE_URL=http://localhost:3000`; return ( - Sign in with Auth0 + Login ); } @@ -262,62 +262,53 @@ APP_BASE_URL=http://localhost:3000`; return ( - Sign out + Logout ); } ``` - ```typescript src/components/Profile.tsx expandable lines + ```typescript src/components/Profile.tsx lines "use client"; import { useUser } from "@auth0/nextjs-auth0/client"; - const FALLBACK_AVATAR = `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='50' fill='%234f46e5'/%3E%3Cpath d='M50 45c7.5 0 13.64-6.14 13.64-13.64S57.5 17.72 50 17.72s-13.64 6.14-13.64 13.64S42.5 45 50 45zm0 6.82c-9.09 0-27.28 4.56-27.28 13.64v3.41c0 1.88 1.53 3.41 3.41 3.41h47.74c1.88 0 3.41-1.53 3.41-3.41v-3.41c0-9.08-18.19-13.64-27.28-13.64z' fill='%23fff'/%3E%3C/svg%3E`; + function getInitials(name?: string | null, email?: string | null): string { + if (name) { + const parts = name.trim().split(" "); + return parts.length >= 2 + ? `${parts[0][0]}${parts[1][0]}`.toUpperCase() + : parts[0].slice(0, 2).toUpperCase(); + } + if (email) return email.slice(0, 2).toUpperCase(); + return "U"; + } export default function Profile() { const { user, isLoading } = useUser(); - if (isLoading) { - return ( -
-
-
-
-
-
-
- ); - } - + if (isLoading) return

Loading...

; if (!user) return null; return ( -
-
-
- {user.name { - (e.target as HTMLImageElement).src = FALLBACK_AVATAR; - }} - /> -
- + <> +
+ + + + + + Successfully authenticated
-
-

{user.name}

-

{user.email}

+
+ + {getInitials(user.name, user.email)} + + {user.email}
- - Active - -
+ ); } ``` @@ -327,7 +318,7 @@ APP_BASE_URL=http://localhost:3000`; Replace `src/app/page.tsx` with: - ```typescript src/app/page.tsx expandable lines + ```typescript src/app/page.tsx lines import { auth0 } from "@/lib/auth0"; import LoginButton from "@/components/LoginButton"; import LogoutButton from "@/components/LogoutButton"; @@ -338,47 +329,64 @@ APP_BASE_URL=http://localhost:3000`; const user = session?.user; return ( -
-
-
- -
-
-
- -
- Auth0 - -
-

- Next.js + Auth0 -

-

- Secure, simple authentication -

-
- -
- - {user ? ( -
- - -
- ) : ( -
-

- Sign in to access your account and protected content. -

- -
- )} -
-
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {user ? ( + <> +

Your account

+
+ + + + ) : ( + <> +

Welcome to Sample0

+

+ Get started by logging in to your account +

+
+ + + )} +
+ +
+ Powered by + Auth0
);