diff --git a/src/UserAvatar/UserAvatar.tsx b/src/UserAvatar/UserAvatar.tsx
index 62d02565a..dca084fc8 100644
--- a/src/UserAvatar/UserAvatar.tsx
+++ b/src/UserAvatar/UserAvatar.tsx
@@ -2,19 +2,20 @@ import { Avatar } from "@mui/material";
import React from "react";
import { UserAvatarProps } from "./UserAvatar.types";
+// returns the first char of first name and first char of last name
+const getFirstAndLastChars = (str: string) => {
+ return str.charAt(0) + str.charAt(str.length - 1);
+};
+
/**
* UserAvatar component
*/
export default function UserAvatar({
img,
name = "",
- color = "rgb(0,0,0)"
+ color = "rgb(0,0,0)",
+ sx
}: UserAvatarProps) {
- // returns the first char of first name and first char of last name
- const getFirstAndLastChars = (str: string) => {
- return str.charAt(0) + str.charAt(str.length - 1);
- };
-
// set icon name
let initials = (name === "" ? "?" : name)
.split(" ")
@@ -27,9 +28,16 @@ export default function UserAvatar({
return (
<>
{img ? (
-
+
) : (
- {initials}
+
+ {initials}
+
)}
>
);
diff --git a/src/UserAvatar/UserAvatar.types.ts b/src/UserAvatar/UserAvatar.types.ts
index f69d4aa8e..97e2bd5a5 100644
--- a/src/UserAvatar/UserAvatar.types.ts
+++ b/src/UserAvatar/UserAvatar.types.ts
@@ -1,3 +1,5 @@
+import { SxProps, Theme } from "@mui/material";
+
export type UserAvatarProps = {
/**
* Icon background color
@@ -11,4 +13,8 @@ export type UserAvatarProps = {
* Display Name
*/
name?: string;
+ /**
+ * Styling
+ */
+ sx?: SxProps;
};
diff --git a/src/UserMenu/UserMenu.tsx b/src/UserMenu/UserMenu.tsx
index f81747750..3338d8935 100644
--- a/src/UserMenu/UserMenu.tsx
+++ b/src/UserMenu/UserMenu.tsx
@@ -1,5 +1,4 @@
import {
- Avatar,
Divider,
IconButton,
ListItemIcon,
@@ -10,7 +9,6 @@ import {
} from "@mui/material";
import { ExitToApp, VpnKey } from "@mui/icons-material";
import React, { Fragment } from "react";
-import { UserAvatarProps, UserMenuProps } from "./UserMenu.types";
import {
bindMenu,
bindTrigger,
@@ -18,6 +16,8 @@ import {
} from "material-ui-popup-state/hooks";
import { Theme } from "@mui/material/styles";
+import { UserAvatar } from "../UserAvatar";
+import { UserMenuProps } from "./UserMenu.types";
// styling
const sx = {
@@ -58,7 +58,15 @@ export default function UserMenu({
return (
-
+