diff --git a/frontend/src/components/molecules/UserProfileButton.tsx b/frontend/src/components/molecules/UserProfileButton.tsx index 62f00957..7a69b468 100644 --- a/frontend/src/components/molecules/UserProfileButton.tsx +++ b/frontend/src/components/molecules/UserProfileButton.tsx @@ -8,9 +8,10 @@ import Menu from "@mui/material/Menu"; import { useTranslations } from "next-intl"; import * as React from "react"; import { Button } from "../atoms"; +import theme from "@/theme"; export default function UserProfileButton({ - user + user, }: { user: Pick; }) { @@ -18,9 +19,12 @@ export default function UserProfileButton({ const t = useTranslations(); const [anchorEl, setAnchorEl] = React.useState(null); + const [menuWidth, setMenuWidth] = React.useState(null); + const open = Boolean(anchorEl); const handleClick = (event: React.MouseEvent) => { setAnchorEl(event.currentTarget); + setMenuWidth(event.currentTarget.offsetWidth); }; const handleClose = () => { setAnchorEl(null); @@ -31,8 +35,8 @@ export default function UserProfileButton({ type: "signUpModal", state: { showCloseButton: true, - title: t("Modals.editProfile.headline") - } + title: t("Modals.editProfile.headline"), + }, }); handleClose(); }; @@ -41,8 +45,8 @@ export default function UserProfileButton({ openModal({ type: "signOutModal", state: { - homeRedirectionPath: PATHS.home - } + homeRedirectionPath: PATHS.home, + }, }); }; @@ -87,10 +91,14 @@ export default function UserProfileButton({ open={open} onClose={handleClose} MenuListProps={{ - "aria-labelledby": "basic-button" + "aria-labelledby": "basic-button", }} PaperProps={{ - style: { boxShadow: "none" } + style: { + boxShadow: "none", + border: `1px solid ${theme.palette.primary.main}`, + minWidth: menuWidth || "auto", + }, }} >