add onclick to avatar
This commit is contained in:
1 parent
7900e1104f
commit
521c6988a5
2 files changed
+10
-2
No files matched your search
@@ -15,7 +15,7 @@ import { useTheme } from "@emotion/react";
|
|||||||
* <Avatar src="assets/img" first="Alex" last="Holliday" small />
|
* <Avatar src="assets/img" first="Alex" last="Holliday" small />
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const Avatar = ({ src, small, sx }) => {
|
const Avatar = ({ src, small, sx, onClick = () => {} }) => {
|
||||||
const { user } = useSelector((state) => state.auth);
|
const { user } = useSelector((state) => state.auth);
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
@@ -31,6 +31,7 @@ const Avatar = ({ src, small, sx }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<MuiAvatar
|
<MuiAvatar
|
||||||
|
onClick={onClick}
|
||||||
alt={`${user?.firstName} ${user?.lastName}`}
|
alt={`${user?.firstName} ${user?.lastName}`}
|
||||||
/* TODO What is the /static/images/avatar/2.jpg ?*/
|
/* TODO What is the /static/images/avatar/2.jpg ?*/
|
||||||
src={src ? src : user?.avatarImage ? image : "/static/images/avatar/2.jpg"}
|
src={src ? src : user?.avatarImage ? image : "/static/images/avatar/2.jpg"}
|
||||||
@@ -66,6 +67,7 @@ Avatar.propTypes = {
|
|||||||
src: PropTypes.string,
|
src: PropTypes.string,
|
||||||
small: PropTypes.bool,
|
small: PropTypes.bool,
|
||||||
sx: PropTypes.object,
|
sx: PropTypes.object,
|
||||||
|
onClick: PropTypes.func,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Avatar;
|
export default Avatar;
|
||||||
@@ -100,7 +100,13 @@ const AuthFooter = ({ collapsed, accountMenuItems }) => {
|
|||||||
borderRadius={theme.shape.borderRadius}
|
borderRadius={theme.shape.borderRadius}
|
||||||
boxSizing={"border-box"}
|
boxSizing={"border-box"}
|
||||||
>
|
>
|
||||||
<Avatar small={true} />
|
<Avatar
|
||||||
|
small={true}
|
||||||
|
onClick={(e) => collapsed && openPopup(e)}
|
||||||
|
sx={{
|
||||||
|
cursor: collapsed ? "pointer" : "default",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
<Stack
|
<Stack
|
||||||
direction={"row"}
|
direction={"row"}
|
||||||
|
|||||||
Reference in new issue
Block a user