Skip to content

Commit bee8ad1

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 0b47932 + 8863bfb commit bee8ad1

File tree

7 files changed

+38
-10
lines changed

7 files changed

+38
-10
lines changed

docs/ngx-auth-firebaseui-avatar.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,13 @@ or more advanced
9292
|:---------------------|:------:|:------:|:------------:|:-------------------------------------------------------------------------------------------------|
9393
| canLogout | `Input()` | `boolean` | true | whether to render the logout button
9494
| links | `Input()` | `LinkMenuItem[]` | - | additional routes and links to add to the component
95+
| mode | `Input()` | `string: 'default' | 'simple'` | `default` | in which mode show details in the menu
96+
| canViewAccount | `Input()` | `boolean` | true | whether to render the profile button to view account
9597
| canDeleteAccount | `Input()` | `boolean` | true | whether to render the delete account button
9698
| canEditAccount | `Input()` | `boolean` | true | whether to render the edit account button
97-
| onSignOut | `Output()`| void | - | this will be fired when the user signs out
99+
| textProfile | `Input()` | `string` | `Profile` | text at the profile button
100+
| textSignOut | `Input()` | `string` | `Sign Out` | text at the sign out button
101+
| onSignOut | `Output()`| void | - | this will be fired when the user signs out
98102

99103

100104
```ts
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<button *ngIf="user"
2+
class="ngx-auth-firebaseui-avatar-button"
23
[matMenuTriggerFor]="posXMenu"
34
[matTooltip]="user?.displayName"
45
[style.background-image]="'url(' + user?.photoURL + ')'"
@@ -8,11 +9,12 @@
89
<span *ngIf="!user?.photoURL">{{displayNameInitials || ''}}</span>
910
</button>
1011

11-
<mat-menu #posXMenu="matMenu" class="before" xPosition="before">
12-
<div fxLayout="row" fxLayout.xs="column" style="padding-left: 10px; padding-right: 10px">
12+
<mat-menu #posXMenu="matMenu" class="before ngx-auth-firebaseui-avatar-menu" xPosition="before" >
13+
<div fxLayout="row" fxLayout.xs="column" style="padding-left: 10px; padding-right: 10px" [ngStyle]="{ 'padding-top.px': layout === 'default' ? 0 : 10 }">
1314
<button [style.background-image]="'url(' + user?.photoURL + ')'"
1415
mat-fab
15-
style="background-size: cover">
16+
style="background-size: cover"
17+
*ngIf="layout === 'default'">
1618
<span *ngIf="!user?.photoURL">{{displayNameInitials || ''}}</span>
1719
</button>
1820
<div fxLayout="column" style="padding-left: 10px; padding-right: 10px">
@@ -21,15 +23,15 @@
2123
</div>
2224
</div>
2325

24-
<div fxFlex="100" fxLayout="column">
26+
<div fxFlex="100" fxLayout="column" [ngStyle]="{ 'padding-bottom.px': layout === 'default' ? 0 : 10 } ">
2527
<div *ngFor="let menuItem of links" class="links-menu">
2628
<button (click)="menuItem?.callback()" mat-menu-item>
2729
<mat-icon>{{menuItem?.icon}}</mat-icon>
2830
{{menuItem?.text}}</button>
2931
</div>
30-
<button (click)="openProfile()" color="primary" fxLayoutAlign="center" mat-raised-button>Profile
32+
<button *ngIf="canViewAccount" (click)="openProfile()" color="primary" fxLayoutAlign="center" mat-raised-button>{{ textProfile }}
3133
</button>
32-
<button (click)="signOut()" *ngIf="canLogout" color="warn" fxLayoutAlign="center" mat-raised-button>Sign Out
34+
<button (click)="signOut()" *ngIf="canLogout" color="warn" fxLayoutAlign="center" mat-raised-button>{{ textSignOut }}
3335
</button>
3436
</div>
3537
</mat-menu>

projects/ngx-auth-firebaseui/src/lib/components/ngx-auth-firebaseui-avatar/ngx-auth-firebaseui-avatar.component.ts

+12
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,30 @@ export interface LinkMenuItem {
1919
})
2020
export class NgxAuthFirebaseuiAvatarComponent implements OnInit {
2121

22+
@Input()
23+
layout: 'default' | 'simple' = 'default';
24+
2225
@Input()
2326
canLogout = true;
2427

2528
@Input()
2629
links: LinkMenuItem[];
2730

31+
@Input()
32+
canViewAccount = true;
33+
2834
@Input()
2935
canDeleteAccount = true;
3036

3137
@Input()
3238
canEditAccount = true;
3339

40+
@Input()
41+
textProfile = 'Profile';
42+
43+
@Input()
44+
textSignOut = 'Sign Out';
45+
3446
// tslint:disable-next-line:no-output-on-prefix
3547
@Output()
3648
onSignOut: EventEmitter<void> = new EventEmitter();

projects/ngx-auth-firebaseui/src/lib/components/ngx-auth-firebaseui/auth.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<div class="user-email mat-body-2">{{ user?.email }}</div>
3232
<div class="actions">
3333
<mat-progress-bar *ngIf="isLoading" mode="indeterminate"></mat-progress-bar>
34-
<a [routerLink]="goBackURL" class="go-back-button action-button" color="primary"
34+
<a *ngIf="verifyEmailGoBackText" [routerLink]="goBackURL" class="go-back-button action-button" color="primary"
3535
mat-stroked-button>{{ verifyEmailGoBackText }}</a>
3636
<button (click)="signOut()" class="sign-out-button action-button" color="warn"
3737
mat-stroked-button>{{ signOutText }}</button>

projects/ngx-auth-firebaseui/src/lib/components/ngx-auth-firebaseui/auth.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export class AuthComponent implements OnInit, AfterViewInit, OnChanges, OnDestro
106106
// See email-confirmation component
107107
@Input() verifyEmailTitleText: string;
108108
@Input() verifyEmailConfirmationText: string;
109-
@Input() verifyEmailGoBackText = 'Go back';
109+
@Input() verifyEmailGoBackText: string;
110110
@Input() sendNewVerificationEmailText: string;
111111
@Input() signOutText = 'Sign out';
112112

src/app/app.component.html

+6-1
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,12 @@
335335

336336
</a>
337337

338-
<ngx-auth-firebaseui-avatar></ngx-auth-firebaseui-avatar>
338+
DEFAULT <ngx-auth-firebaseui-avatar></ngx-auth-firebaseui-avatar>
339+
SIMPLE <ngx-auth-firebaseui-avatar [layout]="'simple'"
340+
[canViewAccount]="false"
341+
[textProfile]="'My profile'"
342+
[textSignOut]="'Logout'"></ngx-auth-firebaseui-avatar>
343+
339344
</div>
340345

341346
<div class="content" role="main">

src/styles.scss

+5
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@
22

33
html, body { height: 100%; }
44
body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }
5+
6+
// Custom CSS style for avatar mat-menu
7+
.ngx-auth-firebaseui-avatar-menu {
8+
margin-top: 5px;
9+
}

0 commit comments

Comments
 (0)