Skip to content

Commit 487a40b

Browse files
authored
rtl for person-card and subsequent sections (#791)
1 parent 2b2d54f commit 487a40b

File tree

10 files changed

+84
-9
lines changed

10 files changed

+84
-9
lines changed

packages/mgt-components/src/components/mgt-person-card/mgt-person-card.scss

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,3 +316,20 @@ $person-card-background-color: var(--person-card-background-color, #ffffff);
316316
}
317317
}
318318
}
319+
320+
[dir='rtl'] {
321+
.base-icons {
322+
span {
323+
margin-right: 8px;
324+
}
325+
}
326+
.nav__back {
327+
width: 20px !important;
328+
-moz-transform: scaleX(-1);
329+
-o-transform: scaleX(-1);
330+
-webkit-transform: scaleX(-1);
331+
transform: scaleX(-1);
332+
filter: FlipH;
333+
-ms-filter: 'FlipH';
334+
}
335+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ export class MgtPersonCard extends MgtTemplatedComponent {
426426
const expandedDetailsTemplate = this.isExpanded ? this.renderExpandedDetails() : this.renderExpandedDetailsButton();
427427

428428
return html`
429-
<div class="root">
429+
<div class="root" dir=${this.direction}>
430430
${navigationTemplate}
431431
<div class="person-details-container">${personDetailsTemplate}</div>
432432
<div class="expanded-details-container">${expandedDetailsTemplate}</div>

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,21 @@
121121
}
122122
}
123123
}
124+
125+
[dir='rtl'] {
126+
.part__link {
127+
&.phone {
128+
text-align: right;
129+
direction: ltr;
130+
}
131+
}
132+
.part__icon {
133+
margin: 10px 20px 0px 0px !important;
134+
}
135+
&.compact {
136+
.part__icon {
137+
margin-left: 6px !important;
138+
margin-top: 0px !important;
139+
}
140+
}
141+
}

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import { User } from '@microsoft/microsoft-graph-types';
99
import { customElement, html, TemplateResult } from 'lit-element';
1010
import { TeamsHelper } from '@microsoft/mgt-element';
11+
import { classMap } from 'lit-html/directives/class-map';
1112

1213
import { getEmailFromGraphEntity } from '../../../../graph/graph.people';
1314
import { BasePersonCardSection } from '../BasePersonCardSection';
@@ -193,7 +194,7 @@ export class MgtPersonCardContact extends BasePersonCardSection {
193194
`;
194195

195196
return html`
196-
<div class="root compact">
197+
<div class="root compact" dir=${this.direction}>
197198
${contentTemplate}
198199
</div>
199200
`;
@@ -218,7 +219,7 @@ export class MgtPersonCardContact extends BasePersonCardSection {
218219
}
219220

220221
return html`
221-
<div class="root">
222+
<div class="root" dir=${this.direction}>
222223
<div class="title">${this.displayName}</div>
223224
${contentTemplate}
224225
</div>
@@ -234,9 +235,20 @@ export class MgtPersonCardContact extends BasePersonCardSection {
234235
* @memberof MgtPersonCardContact
235236
*/
236237
protected renderContactPart(part: IContactPart): TemplateResult {
238+
let isPhone = false;
239+
240+
if (part.title === 'Mobile Phone' || part.title === 'Business Phone') {
241+
isPhone = true;
242+
}
243+
244+
const partLinkClasses = {
245+
part__link: true,
246+
phone: isPhone
247+
};
248+
237249
const valueTemplate = part.onClick
238250
? html`
239-
<span class="part__link" @click=${(e: Event) => part.onClick(e)}>${part.value}</span>
251+
<span class=${classMap(partLinkClasses)} @click=${(e: Event) => part.onClick(e)}>${part.value}</span>
240252
`
241253
: html`
242254
${part.value}

packages/mgt-components/src/components/mgt-person-card/sections/mgt-person-card-files/mgt-person-card-files.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,12 @@
7777
}
7878
}
7979
}
80+
81+
[dir='rtl'] {
82+
.file__icon {
83+
margin-right: 0px !important;
84+
}
85+
.file__details {
86+
margin-right: 12px !important;
87+
}
88+
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export class MgtPersonCardFiles extends BasePersonCardSection {
8686
}
8787

8888
return html`
89-
<div class="root compact">
89+
<div class="root compact" dir=${this.direction}>
9090
${contentTemplate}
9191
</div>
9292
`;
@@ -113,7 +113,7 @@ export class MgtPersonCardFiles extends BasePersonCardSection {
113113
}
114114

115115
return html`
116-
<div class="root">
116+
<div class="root" dir=${this.direction}>
117117
<div class="title">Files</div>
118118
${contentTemplate}
119119
</div>

packages/mgt-components/src/components/mgt-person-card/sections/mgt-person-card-organization/mgt-person-card-organization.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,16 @@
172172
}
173173
}
174174
}
175+
176+
[dir='rtl'] {
177+
.org-member {
178+
.org-member__more {
179+
-moz-transform: scaleX(-1);
180+
-o-transform: scaleX(-1);
181+
-webkit-transform: scaleX(-1);
182+
transform: scaleX(-1);
183+
filter: FlipH;
184+
-ms-filter: 'FlipH';
185+
}
186+
}
187+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export class MgtPersonCardOrganization extends BasePersonCardSection {
127127
}
128128

129129
return html`
130-
<div class="root">
130+
<div class="root" dir=${this.direction}>
131131
<div class="title">Organization</div>
132132
${contentTemplate}
133133
</div>

packages/mgt-components/src/components/mgt-person-card/sections/mgt-person-card-profile/mgt-person-card-profile.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,9 @@
159159
}
160160
}
161161
}
162+
163+
[dir='rtl'] {
164+
.token-list__item {
165+
margin-right: 0px !important;
166+
}
167+
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export class MgtPersonCardProfile extends BasePersonCardSection {
129129
*/
130130
protected renderCompactView(): TemplateResult {
131131
return html`
132-
<div class="root compact">
132+
<div class="root compact" dir=${this.direction}>
133133
${this.renderSubSections().slice(0, 2)}
134134
</div>
135135
`;
@@ -146,7 +146,7 @@ export class MgtPersonCardProfile extends BasePersonCardSection {
146146
this.initPostRenderOperations();
147147

148148
return html`
149-
<div class="root">
149+
<div class="root" dir=${this.direction}>
150150
<div class="title">About</div>
151151
${this.renderSubSections()}
152152
</div>

0 commit comments

Comments
 (0)