Refactor Header.jsx to place users name, email, and avatar in a group on the right side of the header

This commit is contained in:
Daniel S. Hansen
2025-07-17 11:03:55 -07:00
parent 5c68b1c5c3
commit 7da843b573
+5 -2
View File
@@ -1,4 +1,4 @@
import { chakra, useRecipe, Box, Button, Avatar, Stack, Text, Menu, Portal } from "@chakra-ui/react" import { chakra, useRecipe, Box, Button, Avatar, Stack, Text, Menu, Portal, Flex } from "@chakra-ui/react"
export default function Header() { export default function Header() {
const recipe = useRecipe({ key: "header" }); const recipe = useRecipe({ key: "header" });
@@ -7,10 +7,12 @@ export default function Header() {
return ( return (
<chakra.div css={styles}> <chakra.div css={styles}>
<Button color="color" variant="plain" textStyle="5xl" fontWeight="bold">VDAP</Button> <Button color="color" variant="plain" textStyle="5xl" fontWeight="bold">VDAP</Button>
<Stack gap="0"> <Flex align="center" gap={3} pr={6}>
<Stack gap="0" textAlign="right">
<Text color="color" fontWeight="bold" textStyle="lg">{user.name}</Text> <Text color="color" fontWeight="bold" textStyle="lg">{user.name}</Text>
<Text color="fg.muted" textStyle="sm">{user.email}</Text> <Text color="fg.muted" textStyle="sm">{user.email}</Text>
</Stack> </Stack>
{/* Add a drop down menu to the avatar */} {/* Add a drop down menu to the avatar */}
<Menu.Root> <Menu.Root>
<Menu.Trigger rounded="full" focusRing="outside"> <Menu.Trigger rounded="full" focusRing="outside">
@@ -30,6 +32,7 @@ export default function Header() {
</Portal> </Portal>
</Menu.Root> </Menu.Root>
{/* End drop down menu */} {/* End drop down menu */}
</Flex>
</chakra.div> </chakra.div>
); );
} }