mirror of
https://github.com/bubblecup-12/VogelSocialMedia.git
synced 2025-07-08 13:38:47 +00:00
move profile components to profile folder
This commit is contained in:
parent
c8f72daba4
commit
238ec77edf
7 changed files with 0 additions and 0 deletions
|
@ -1,43 +0,0 @@
|
|||
import { Popover, Typography } from "@mui/material";
|
||||
import { useEffect, useState } from "react";
|
||||
import "./username.css";
|
||||
|
||||
export default function Username({ username }: { username: string }) {
|
||||
const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>(null);
|
||||
|
||||
const openPopover = (event: React.MouseEvent<HTMLButtonElement>) => {
|
||||
setAnchorEl(event.currentTarget);
|
||||
};
|
||||
|
||||
const closePopover = () => {
|
||||
setAnchorEl(null);
|
||||
};
|
||||
|
||||
const isPopoverOpen = Boolean(anchorEl);
|
||||
const id = isPopoverOpen ? "simple-popover" : undefined;
|
||||
|
||||
return (
|
||||
<>
|
||||
<Popover
|
||||
className="profile-popover"
|
||||
onClose={closePopover}
|
||||
id={id}
|
||||
open={isPopoverOpen}
|
||||
anchorEl={anchorEl}
|
||||
anchorOrigin={{
|
||||
vertical: "top",
|
||||
horizontal: "left",
|
||||
}}
|
||||
transformOrigin={{
|
||||
vertical: "bottom",
|
||||
horizontal: "left",
|
||||
}}
|
||||
>
|
||||
<Typography sx={{ p: 1 }}>{username}</Typography>
|
||||
</Popover>
|
||||
<span className="profile-username body-bold" onClick={openPopover}>
|
||||
{username}
|
||||
</span>
|
||||
</>
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue