Skip to content

Commit 5911348

Browse files
committed
fix: [FIXUP] DefaultAvatar
1 parent ddb7e61 commit 5911348

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

src/misc/DefaultAvatar/DefaultAvatar.js

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import { Avatar } from '@mui/material';
4-
import makeStyles from '@mui/styles/makeStyles';
54

65
function stringToColor(str) {
76
let hash = 0;
@@ -19,24 +18,21 @@ function stringToColor(str) {
1918
return color;
2019
}
2120

22-
const useStyles = makeStyles((theme) => ({
23-
avatar: {
24-
width: (props) => `${props.size}px`,
25-
height: (props) => `${props.size}px`,
26-
fontSize: (props) => theme.typography.pxToRem(props.size / 2),
27-
backgroundColor: (props) => props.avatarBackgroundColor,
28-
color: (props) => theme.palette.getContrastText(props.avatarBackgroundColor),
29-
},
30-
}));
31-
3221
export const DefaultAvatar = ({ userName = '?', size = 24, variant = 'circular' }) => {
3322
const avatarBackgroundColor = stringToColor(userName);
3423
const letter = userName === '' ? '?' : String.fromCodePoint(userName.codePointAt(0)).toUpperCase();
3524

36-
const classes = useStyles({ avatarBackgroundColor, size });
37-
3825
return (
39-
<Avatar className={classes.avatar} variant={variant}>
26+
<Avatar
27+
variant={variant}
28+
sx={{
29+
width: `${size}px`,
30+
height: `${size}px`,
31+
fontSize: (theme) => theme.typography.pxToRem(size / 2),
32+
backgroundColor: avatarBackgroundColor,
33+
color: (theme) => theme.palette.getContrastText(avatarBackgroundColor),
34+
}}
35+
>
4036
{letter}
4137
</Avatar>
4238
);

0 commit comments

Comments
 (0)