File tree Expand file tree Collapse file tree 2 files changed +24
-5
lines changed
src/components/mgt-person Expand file tree Collapse file tree 2 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -74,18 +74,24 @@ mgt-person .user-avatar {
7474 border-radius : 50% ;
7575 font-weight : 400 ;
7676
77- & .initials-text {
77+ & .initials-text ,
78+ & .ms-Icon {
7879 cursor : default ;
7980 margin-top : -1px ;
8081 font-size : calc (var (--avatar-size , 48px ) * 0.4 );
8182 }
83+
84+ & .ms-Icon {
85+ display : inline ;
86+ }
8287 }
8388
8489 & .small {
8590 width : $avatar-size-s ;
8691 height : $avatar-size-s ;
8792
88- & .initials-text {
93+ & .initials-text ,
94+ & .ms-Icon {
8995 font-size : calc (var (--avatar-size-s , 24px ) * 0.4 );
9096 }
9197 }
Original file line number Diff line number Diff line change @@ -312,6 +312,7 @@ export class MgtPerson extends MgtTemplatedComponent {
312312 this . personDetails && this . personCardInteraction === PersonCardInteraction . none
313313 ? this . personDetails . displayName
314314 : '' ;
315+
315316 const isLarge = this . showEmail && this . showName ;
316317 const imageClasses = {
317318 initials : ! imageSrc ,
@@ -321,19 +322,31 @@ export class MgtPerson extends MgtTemplatedComponent {
321322 } ;
322323
323324 let imageHtml : TemplateResult ;
325+
324326 if ( imageSrc ) {
325327 // render the image
326328 imageHtml = html `
327329 < img alt =${ title } src =${ imageSrc } />
328330 ` ;
329331 } else if ( this . personDetails ) {
330- // render the initials
331- const initials = this . getInitials ( this . personDetails ) ;
332+ // render the initials or person icon
333+
332334 // add avatar background color
333335 imageClasses [ this . _personAvatarBg ] = true ;
336+
337+ const initials = this . getInitials ( this . personDetails ) ;
338+ const initialsHtml =
339+ initials && initials . length
340+ ? html `
341+ ${ initials }
342+ `
343+ : html `
344+ < i class ="ms-Icon ms-Icon--Contact "> </ i >
345+ ` ;
346+
334347 imageHtml = html `
335348 < span class ="initials-text " aria-label ="${ initials } ">
336- ${ initials }
349+ ${ initialsHtml }
337350 </ span >
338351 ` ;
339352 } else {
You can’t perform that action at this time.
0 commit comments