File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -29,9 +29,9 @@ const useStyles = makeStyles((theme) => ({
2929 } ,
3030} ) ) ;
3131
32- export const DefaultAvatar = ( { userName, size = 24 , variant = 'circular' } ) => {
32+ export const DefaultAvatar = ( { userName = '?' , size = 24 , variant = 'circular' } ) => {
3333 const avatarBackgroundColor = stringToColor ( userName ) ;
34- const letter = String . fromCodePoint ( userName . codePointAt ( 0 ) ) . toUpperCase ( ) ;
34+ const letter = userName === '' ? '?' : String . fromCodePoint ( userName . codePointAt ( 0 ) ) . toUpperCase ( ) ;
3535
3636 const classes = useStyles ( { avatarBackgroundColor, size } ) ;
3737
@@ -46,7 +46,7 @@ DefaultAvatar.propTypes = {
4646 /**
4747 * User name to get first letter and compute avatar's color
4848 */
49- userName : PropTypes . string . isRequired ,
49+ userName : PropTypes . string ,
5050 /**
5151 * Icon size in pixels
5252 */
You can’t perform that action at this time.
0 commit comments