Skip to content

Commit 92206b9

Browse files
feat: add dedicated icon for business phone (#1988)
Add title and aria attributes for contact parts. Code formatting as required by prettier. Co-authored-by: Gavin Barron <[email protected]>
1 parent b2cbbf2 commit 92206b9

File tree

3 files changed

+25
-10
lines changed

3 files changed

+25
-10
lines changed

packages/mgt-components/src/components/mgt-person-card/sections/mgt-person-card-contact/mgt-person-card-contact.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export class MgtPersonCardContact extends BasePersonCardSection {
9292
title: this.strings.chatTitle
9393
},
9494
businessPhone: {
95-
icon: getSvg(SvgIcon.CellPhone, '#929292'),
95+
icon: getSvg(SvgIcon.Phone, '#929292'),
9696
onClick: () => this.sendCall(this._person?.businessPhones?.length > 0 ? this._person.businessPhones[0] : null),
9797
showCompact: true,
9898
title: this.strings.businessPhoneTitle
@@ -263,13 +263,15 @@ export class MgtPersonCardContact extends BasePersonCardSection {
263263
`;
264264

265265
return html`
266-
<div class="part" @click=${(e: MouseEvent) => this.handlePartClick(e, part.value)} tabindex="0">
267-
<div class="part__icon">${part.icon}</div>
266+
<div class="part" @click=${(e: MouseEvent) => this.handlePartClick(e, part.value)} tabindex="0">
267+
<div class="part__icon" aria-label=${part.title} title=${part.title}>${part.icon}</div>
268268
<div class="part__details">
269269
<div class="part__title">${part.title}</div>
270-
<div class="part__value">${valueTemplate}</div>
270+
<div class="part__value" title=${part.title}>${valueTemplate}</div>
271271
</div>
272-
<div class="part__copy">
272+
<div class="part__copy" aria-role="button" aria-label=${this.strings.copyToClipboardButton} title=${
273+
this.strings.copyToClipboardButton
274+
}>
273275
${getSvg(SvgIcon.Copy)}
274276
</div>
275277
</div>

packages/mgt-components/src/components/mgt-person-card/sections/mgt-person-card-contact/strings.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ export const strings = {
1313
cellPhoneTitle: 'Mobile Phone',
1414
departmentTitle: 'Department',
1515
titleTitle: 'Title',
16-
officeLocationTitle: 'Office Location'
16+
officeLocationTitle: 'Office Location',
17+
copyToClipboardButton: 'Copy to clipboard'
1718
};

packages/mgt-components/src/utils/SvgHelper.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ export enum SvgIcon {
7272
*/
7373
Copy,
7474

75+
/**
76+
* A phone handset
77+
*/
78+
Phone,
79+
7580
/**
7681
* A cellphone
7782
*/
@@ -305,6 +310,13 @@ export function getSvg(svgIcon: SvgIcon, color?: string) {
305310
</svg>
306311
`;
307312

313+
case SvgIcon.Phone:
314+
return html`
315+
<svg width="15" height="15" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2048 2048" fill="none">
316+
<path d="M1607 1213q44 0 84 16t72 48l220 220q31 31 47 71t17 85q0 44-16 84t-48 72l-14 14q-54 54-99 96t-94 70-109 44-143 15q-125 0-257-39t-262-108-256-164-237-207-206-238-162-256T38 775 0 523q0-83 14-142t43-108 70-93 96-99l16-16q31-31 71-48t85-17q44 0 84 17t72 48l220 220q31 31 47 71t17 85q0 44-15 78t-37 63-48 51-49 45-37 44-15 49q0 38 27 65l551 551q27 27 65 27 26 0 48-15t45-37 45-48 51-49 62-37 79-15zm-83 707q72 0 120-13t88-39 76-64 85-86q27-27 27-65 0-18-14-42t-38-52-51-55-56-54-51-47-37-35q-27-27-66-27-26 0-48 15t-44 37-45 48-52 49-62 37-79 15q-44 0-84-16t-72-48L570 927q-31-31-47-71t-17-85q0-44 15-78t37-63 48-51 49-46 37-44 15-48q0-39-27-66-13-13-34-36t-47-51-54-56-56-52-51-37-43-15q-38 0-65 27l-85 85q-37 37-64 76t-40 87-14 120q0 112 36 231t101 238 153 234 192 219 219 190 234 150 236 99 226 36z" fill="${color}"></path>
317+
</svg>
318+
`;
319+
308320
case SvgIcon.CellPhone:
309321
return html`
310322
<svg width="10" height="15" viewBox="0 0 10 15" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -480,17 +492,17 @@ export function getSvg(svgIcon: SvgIcon, color?: string) {
480492
case SvgIcon.DragFile:
481493
return html`
482494
<svg width="13" height="16" xmlns="http://www.w3.org/2000/svg">
483-
<path
484-
d="m0,1.00189c0,-0.8451 0.983,-1.3091 1.636,-0.772l11.006,9.0622c0.724,0.5964 0.302,1.772 -0.636,1.772l-5.592,0c-0.435,0 -0.849,0.1892 -1.134,0.5185l-3.524,4.0725c-0.606,0.7003 -1.756,0.2717 -1.756,-0.6544l0,-13.9988zm12.006,9.0622l-11.006,-9.0622l0,13.9988l3.524,-4.0724c0.475,-0.5488 1.164,-0.8642 1.89,-0.8642l5.592,0z"
495+
<path
496+
d="m0,1.00189c0,-0.8451 0.983,-1.3091 1.636,-0.772l11.006,9.0622c0.724,0.5964 0.302,1.772 -0.636,1.772l-5.592,0c-0.435,0 -0.849,0.1892 -1.134,0.5185l-3.524,4.0725c-0.606,0.7003 -1.756,0.2717 -1.756,-0.6544l0,-13.9988zm12.006,9.0622l-11.006,-9.0622l0,13.9988l3.524,-4.0724c0.475,-0.5488 1.164,-0.8642 1.89,-0.8642l5.592,0z"
485497
/>
486498
</svg>
487499
`;
488500

489501
case SvgIcon.Cancel:
490502
return html`
491503
<svg class="cancel-icon" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
492-
<path
493-
d="m5.52795,4.92946l4.37418,4.36141l-0.57055,0.56806l-4.38052,-4.35509l-4.38052,4.35509l-0.57055,-0.56806l4.37418,-4.36141l-4.37418,-4.36141l0.57055,-0.56806l4.38052,4.35509l4.38052,-4.35509l0.57055,0.56806l-4.37418,4.36141z"
504+
<path
505+
d="m5.52795,4.92946l4.37418,4.36141l-0.57055,0.56806l-4.38052,-4.35509l-4.38052,4.35509l-0.57055,-0.56806l4.37418,-4.36141l-4.37418,-4.36141l0.57055,-0.56806l4.38052,4.35509l4.38052,-4.35509l0.57055,0.56806l-4.37418,4.36141z"
494506
/>
495507
</svg>
496508
`;

0 commit comments

Comments
 (0)