diff --git a/src/compornents/TopBar.tsx b/src/compornents/TopBar.tsx index 891d9d3..5c3519c 100644 --- a/src/compornents/TopBar.tsx +++ b/src/compornents/TopBar.tsx @@ -2,6 +2,7 @@ import { AccountCircle, ExitToAppSharp } from "@mui/icons-material"; import { AppBar, Button, Toolbar, Typography } from "@mui/material"; import { signOut } from "next-auth/react"; import React from "react"; +import UserMenu from "./UserMenu"; interface QuestionProps { page_name: string; @@ -16,11 +17,7 @@ export default function TopBar({ page_name = "", user_name = "Unknown User" }: Q {page_name} - - - {user_name} - - + diff --git a/src/compornents/UserMenu.tsx b/src/compornents/UserMenu.tsx new file mode 100644 index 0000000..5f42bb0 --- /dev/null +++ b/src/compornents/UserMenu.tsx @@ -0,0 +1,42 @@ +// トップバーに表示するための、ユーザーメニューを表示するコンポーネント +// アイコンとユーザー名を表示し、クリックするとメニューが表示される + +import React from 'react'; +import { AccountCircle, ExitToAppSharp } from "@mui/icons-material"; +import { Button, Menu, MenuItem } from "@mui/material"; +import { signOut } from "next-auth/react"; +import { ArrowDropDownIcon } from '@mui/x-date-pickers'; + +interface UserMenuProps { + user_name: string; +} + +export default function UserMenu({ user_name }: UserMenuProps) { + const [anchorEl, setAnchorEl] = React.useState(null); + + const handleClick = (event: React.MouseEvent) => { + setAnchorEl(event.currentTarget); + }; + + return ( + <> + + setAnchorEl(null)} + > + signOut()}>SignOut + + + ); +} \ No newline at end of file