Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions frontend/src/components/profileAvatarDisplay.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const ProfileAvatarDisplay = ({ firstLetter, onClick }) => {
return (
<div
onClick={onClick}
className="flex items-center justify-center w-10 h-10 rounded-full bg-purple-600 text-white font-bold text-lg cursor-pointer"
>
{firstLetter}
</div>
);
};

export default ProfileAvatarDisplay;
11 changes: 5 additions & 6 deletions frontend/src/components/profileMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@ import { useState } from "react";
import { Link } from "react-router";
import { useDispatch} from "react-redux";
import { logout } from "../slice/authSlice";
import ProfileAvatarDisplay from "./profileAvatarDisplay";
const ProfileMenu = ({ firstLetter }) => {
const [open, setOpen] = useState(false);
const dispatch = useDispatch();
return (
<div className="relative">
<div
onClick={() => setOpen(!open)}
className="flex items-center justify-center w-10 h-10 rounded-full bg-purple-600 text-white font-bold text-lg cursor-pointer"
>
{firstLetter}
</div>
<ProfileAvatarDisplay
firstLetter={firstLetter}
onClick={() => setOpen(!open)}
/>

{open && (
<ul className="menu bg-base-200 rounded-box w-56 absolute right-0 mt-3 shadow-lg border border-gray-700 z-50">
Expand Down