Skip to content

Commit

Permalink
add picture in user Avatar
Browse files Browse the repository at this point in the history
  • Loading branch information
hdcola committed Nov 2, 2024
1 parent 40f9f7a commit 3289188
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const Navbar = () => {
const [searchQuery, setSearchQuery] = useState<string>('');
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
const open = Boolean(anchorEl);
const { isLoggedIn, logout, username } = useLoginStore();
const { isLoggedIn, logout, username, picture } = useLoginStore();

const navigate = useNavigate();
const handleClick = (event: MouseEvent<HTMLButtonElement>) => {
Expand Down Expand Up @@ -126,7 +126,14 @@ const Navbar = () => {
</IconButton>
{isLoggedIn ? (
<IconButton onClick={handleClick}>
<Avatar>{username}</Avatar>
{picture ? (
<Avatar
alt={username}
src={picture}
></Avatar>
) : (
<Avatar>{username}</Avatar>
)}
</IconButton>
) : (
<>
Expand Down

0 comments on commit 3289188

Please sign in to comment.