From 5ab1f7350fc1e24ffd3f9a6222875e38d7a5aee7 Mon Sep 17 00:00:00 2001 From: RaviAnand Mohabir Date: Mon, 8 May 2023 15:39:00 +0200 Subject: [PATCH 1/8] fix: :lipstick: fix align center for header content --- src/components/header.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/header.tsx b/src/components/header.tsx index d3fdc2f..e9a3cc0 100644 --- a/src/components/header.tsx +++ b/src/components/header.tsx @@ -30,7 +30,7 @@ function Header({ signUpEnabled }: HeaderProps) { return ( - + - + {user ? ( router.asPath !== "/posts/create" && ( From 81e41b7214ce2cd50a9365ba54f210ff87e5abe0 Mon Sep 17 00:00:00 2001 From: RaviAnand Mohabir Date: Tue, 9 May 2023 09:18:13 +0200 Subject: [PATCH 2/8] feat: :sparkles: add menu in header with profile and log out actions --- src/components/header.tsx | 87 ++++++++++++++++++++++++++++----------- 1 file changed, 64 insertions(+), 23 deletions(-) diff --git a/src/components/header.tsx b/src/components/header.tsx index e9a3cc0..13f3921 100644 --- a/src/components/header.tsx +++ b/src/components/header.tsx @@ -2,18 +2,26 @@ import { useAuthMethods } from "@/hooks/useAuthMethods"; import { usePocketBase } from "@/pocketbase"; import { useAuth } from "@/pocketbase/auth"; import { - ActionIcon, Anchor, + Avatar, Box, Button, Group, Header as MantineHeader, MediaQuery, + Menu, + Text, Title, + UnstyledButton, em, getBreakpointValue, } from "@mantine/core"; -import { IconCirclePlus, IconLogout } from "@tabler/icons-react"; +import { + IconCaretDown, + IconCirclePlus, + IconLogout, + IconUserCircle, +} from "@tabler/icons-react"; import Link from "next/link"; import { useRouter } from "next/router"; @@ -51,28 +59,61 @@ function Header({ signUpEnabled }: HeaderProps) { {user ? ( - router.asPath !== "/posts/create" && ( - - - pb.authStore.clear()}> - - - - ) + + + )} + + + ({ + ":hover": { + background: theme.colors.dark[4], + borderRadius: theme.radius.md, + }, + })} + pr="sm" + py={2} + > + + + + {user.username} + + + + + + + + } + component={Link} + href={`/users/${user.id}`} + > + Profile + + + } + onClick={() => pb.authStore.clear()} + > + Log Out + + + + ) : ( + )}