From 2298347e84fd19f0ca11ce480aa029d657fdadea Mon Sep 17 00:00:00 2001 From: "Daniel S. Hansen" Date: Thu, 17 Jul 2025 15:35:01 -0700 Subject: [PATCH] Refactor header: extract Avatar into standalone UserAvatarMenu component, and add _hover styling --- client/src/components/Header.jsx | 24 +++---------------- client/src/components/UserAvatarMenu.jsx | 30 ++++++++++++++++++++++++ client/src/theme.js | 4 ++-- 3 files changed, 35 insertions(+), 23 deletions(-) create mode 100644 client/src/components/UserAvatarMenu.jsx diff --git a/client/src/components/Header.jsx b/client/src/components/Header.jsx index 53af68f..a9ee737 100644 --- a/client/src/components/Header.jsx +++ b/client/src/components/Header.jsx @@ -1,4 +1,5 @@ -import { chakra, useRecipe, Box, Button, Avatar, Stack, Text, Menu, Portal, Flex } from "@chakra-ui/react" +import { chakra, useRecipe, Box, Button, Stack, Text, Flex } from "@chakra-ui/react" +import UserAvatarMenu from "./UserAvatarMenu"; export default function Header() { const recipe = useRecipe({ key: "header" }); @@ -12,26 +13,7 @@ export default function Header() { {user.name} {user.email} - - {/* Add a drop down menu to the avatar */} - - - - - - - - - - - Account - Settings - Logout - - - - - {/* End drop down menu */} + ); diff --git a/client/src/components/UserAvatarMenu.jsx b/client/src/components/UserAvatarMenu.jsx new file mode 100644 index 0000000..d7a5850 --- /dev/null +++ b/client/src/components/UserAvatarMenu.jsx @@ -0,0 +1,30 @@ +import { Avatar, Menu, Portal, Box } from "@chakra-ui/react" + + +export default function UserAvatarMenu({ name, avatar }) { + return ( + + + + + + + + + + + + + Account + Settings + Logout + + + + + ); +} \ No newline at end of file diff --git a/client/src/theme.js b/client/src/theme.js index 3268701..360cf14 100644 --- a/client/src/theme.js +++ b/client/src/theme.js @@ -57,9 +57,9 @@ const config = defineConfig({ base200: { value: {base: "#eef2f6", _dark: "#242424"}}, base300: { value: {base: "#dfe5ed", _dark: "#60645a"}}, // primary: { value: {base: "#9cd855", _dark: "#629631"}}, - primary: { value: {base: "#2B98F8", _dark: "#629631"}}, + primary: { value: {base: "#2B98F8", _dark: "#2B98F8"}}, // primaryLt: { value: {base: "#c9e9a0", _dark: "#92948e"}}, - primaryLt: { value: {base: "#2BCFF8", _dark: "#92948e"}}, + primaryLt: { value: {base: "#2BCFF8", _dark: "#2BCFF8"}}, secondaryBG: { value: {base: "#EDF1F1", _dark: "#121212"}}, border: {value: {base: "#000000", _dark: "#CBCBCB"}}, text: {value: {base: "#19332D", _dark: "#CBCBCB"}},