From dcf07fe0a151b06e278b3ca54f471ff1d7ac007e Mon Sep 17 00:00:00 2001 From: jahooma Date: Thu, 13 Jan 2022 16:09:13 -0600 Subject: [PATCH] Load navbar more gracefully: don't show options until user loaded --- web/components/manifold-logo.tsx | 3 +- web/components/nav-bar.tsx | 102 ++++++++++++++----------------- 2 files changed, 49 insertions(+), 56 deletions(-) diff --git a/web/components/manifold-logo.tsx b/web/components/manifold-logo.tsx index 545093e5..6d600ab2 100644 --- a/web/components/manifold-logo.tsx +++ b/web/components/manifold-logo.tsx @@ -1,4 +1,5 @@ import Link from 'next/link' +import Image from 'next/image' import clsx from 'clsx' export function ManifoldLogo(props: { darkBackground?: boolean }) { @@ -7,7 +8,7 @@ export function ManifoldLogo(props: { darkBackground?: boolean }) { return ( - - {children} - - {!user && ( - - - - )} - - - - - - {user ? ( - - ) : ( - + {(user || user === null) && ( + )} @@ -69,41 +40,62 @@ export function NavBar(props: { ) } -function SignedInHeaders(props: { user: User; themeClasses?: string }) { +function NavOptions(props: { user: User | null; themeClasses: string }) { const { user, themeClasses } = props - return ( <> - + {user === null && ( + + + + )} + + - - - ) -} - -function SignedOutHeaders(props: { themeClasses?: string }) { - const { themeClasses } = props - - return ( - <> -
- Sign in -
+ {user === null ? ( + <> +
+ Sign in +
+ + ) : ( + <> + + + + + + + )} ) }