Skip to content

Commit 27b7704

Browse files
committed
feat(package): added animations to the ngx-auth-firebaseui component
1 parent 6539538 commit 27b7704

File tree

11 files changed

+376
-283
lines changed

11 files changed

+376
-283
lines changed

assets/v3.4.0/login.gif

169 KB
Loading

assets/v3.4.0/login_x10.gif

1.15 MB
Loading

demo/src/app/home/home.component.html

Lines changed: 250 additions & 247 deletions
Large diffs are not rendered by default.

src/module/animations/index.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import {animate, animateChild, animation, query, stagger, state, style, transition, trigger, useAnimation} from '@angular/animations';
2+
3+
const customAnimation = animation(
4+
[
5+
style({
6+
opacity: '{{opacity}}',
7+
transform: 'scale({{scale}}) translate3d({{x}}, {{y}}, {{z}})'
8+
}),
9+
animate('{{duration}} {{delay}} cubic-bezier(0.0, 0.0, 0.2, 1)', style('*'))
10+
],
11+
{
12+
params: {
13+
duration: '200ms',
14+
delay: '0ms',
15+
opacity: '0',
16+
scale: '1',
17+
x: '0',
18+
y: '0',
19+
z: '0'
20+
}
21+
}
22+
);
23+
24+
export const NgxAuthFirebaseuiAnimations = [
25+
trigger('animate', [transition('void => *', [useAnimation(customAnimation)])]),
26+
27+
trigger('animateStagger', [
28+
state('50', style('*')),
29+
state('100', style('*')),
30+
state('200', style('*')),
31+
32+
transition('void => 50', query('@*', [stagger('50ms', [animateChild()])], {optional: true})),
33+
transition('void => 100', query('@*', [stagger('100ms', [animateChild()])], {optional: true})),
34+
transition('void => 200', query('@*', [stagger('200ms', [animateChild()])], {optional: true}))
35+
]),
36+
];

src/module/components/ngx-auth-firebaseui-login/ngx-auth-firebaseui-login.component.html

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
<div id="login-form-wrapper" fxLayout="column" fxLayoutAlign="center center">
44

5-
<!-- <div id="login-form" [@animate]="{value:'*',params:{duration:'300ms',y:'100px'}}">-->
6-
<div id="login-form">
5+
<div id="login-form" [@animateStagger]="{ value: '50' }">
76

87
<div *ngIf="logoUrl" class="logo">
9-
<img [src]="logoUrl" alt="logo">
8+
<img [src]="logoUrl" alt="logo" [@animate]="{ value: '*', params: { x: '50px' } }">
109
</div>
1110

12-
<div class="title">{{titleText}}</div>
11+
<div class="title" [@animate]="{ value: '*', params: { x: '-50px' } }">{{titleText}}</div>
1312

14-
<form name="loginForm" [formGroup]="loginForm" novalidate>
13+
<form name="loginForm" [formGroup]="loginForm" novalidate
14+
[@animate]="{value:'*',params:{duration:'300ms',y:'100px'}}">
1515

16-
<mat-form-field [appearance]="appearance">
16+
<mat-form-field [appearance]="appearance" [@animate]="{ value: '*', params: { x: '50px' } }">
1717
<input matInput [placeholder]="emailText" formControlName="email">
1818
<mat-icon matSuffix color="primary">email</mat-icon>
1919
<mat-error *ngIf="loginForm.get('email').hasError('required')">
@@ -26,21 +26,24 @@
2626
</mat-error>
2727
</mat-form-field>
2828

29-
<mat-form-field [appearance]="appearance">
29+
<mat-form-field [appearance]="appearance" [@animate]="{ value: '*', params: { x: '50px' } }">
3030
<input matInput type="password" [placeholder]="passwordText" formControlName="password">
3131
<mat-icon matSuffix color="primary">lock</mat-icon>
3232
<mat-error>
3333
{{passwordErrorRequiredText}}
3434
</mat-error>
3535
</mat-form-field>
3636

37-
<div class="remember-forgot-password" fxLayout="row" fxLayout.xs="column"
38-
fxLayoutAlign="space-between center">
37+
<div class="remember-forgot-password"
38+
fxLayout="row" fxLayout.xs="column"
39+
fxLayoutAlign="space-between center"
40+
[@animate]="{ value: '*', params: { x: '50px' } }">
3941
<mat-checkbox class="remember-me" aria-label="Remember Me">
4042
{{rememberMeText}}
4143
</mat-checkbox>
4244

4345
<button *ngIf="resetPasswordEnabled"
46+
[@animate]="{ value: '*', params: { x: '-50px' } }"
4447
mat-button
4548
class="forgot-password"
4649
color="primary"
@@ -61,7 +64,7 @@
6164

6265
</form>
6366

64-
<div class="separator">
67+
<div class="separator" [@animate]="{ value: '*', params: { z: '50px', delay: '50ms', scale: '0.2' } }">
6568
<span class="text">{{orLabelText}}</span>
6669
</div>
6770

@@ -70,17 +73,19 @@
7073
theme="raised"
7174
[providers]="providers"></ngx-auth-firebaseui-providers>
7275

73-
<div class="register" fxLayout="column" fxLayoutAlign="center center">
74-
<span class="text">{{dontHaveAnAccountText}}</span>
75-
<button mat-button
76+
<div class="register"
77+
fxLayout="column" fxLayoutAlign="center center"
78+
[@animateStagger]="{ value: '100' }">
79+
<span class="text" [@animate]="{ value: '*', params: { x: '100px' } }">
80+
{{dontHaveAnAccountText}}
81+
</span>
82+
<button [@animate]="{ value: '*', params: { x: '-100px' } }"
83+
mat-button
7684
id="createAccountButton"
7785
color="primary"
7886
type="button"
7987
(click)="onCreateAccountRequested.emit()">{{createAccountButtonText}}</button>
8088
</div>
81-
8289
</div>
83-
8490
</div>
85-
8691
</div>

src/module/components/ngx-auth-firebaseui-login/ngx-auth-firebaseui-login.component.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ ngx-auth-firebaseui-login {
2121
}
2222

2323
.logo {
24-
width: 128px;
24+
width: 150px;
25+
height: 150px;
2526
margin: 32px auto;
2627
}
2728

src/module/components/ngx-auth-firebaseui-login/ngx-auth-firebaseui-login.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ import {FormBuilder, FormGroup, Validators} from '@angular/forms';
33
import {MatFormFieldAppearance} from '@angular/material';
44
import {AuthProcessService, AuthProvider} from '../../services/auth-process.service';
55
import {Subscription} from 'rxjs';
6+
import {NgxAuthFirebaseuiAnimations} from '../../animations';
67

78
@Component({
89
selector: 'ngx-auth-firebaseui-login',
910
templateUrl: './ngx-auth-firebaseui-login.component.html',
1011
styleUrls: ['./ngx-auth-firebaseui-login.component.scss'],
1112
encapsulation: ViewEncapsulation.None,
13+
animations: NgxAuthFirebaseuiAnimations
1214
})
1315
export class NgxAuthFirebaseuiLoginComponent implements OnInit {
1416

src/module/components/ngx-auth-firebaseui/auth.component.html

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
<mat-card>
66
<mat-card-title>{{signInCardTitleText}}</mat-card-title>
77
<mat-card-content>
8-
<form [formGroup]="signInFormGroup"
8+
<form [@animateStagger]="{ value: '50' }"
9+
[formGroup]="signInFormGroup"
910
(ngSubmit)="signInFormGroup.valid &&
1011
authProcess.signInWith
1112
(authProviders.EmailAndPassword,
1213
{email:signInFormGroup.value.email, password: signInFormGroup.value.password})">
1314
<div fxLayout="column" fxLayoutAlign="center">
14-
<mat-form-field [appearance]="appearance">
15+
<mat-form-field [@animate]="{value:'*',params:{duration:'300ms',y:'100px'}}"
16+
[appearance]="appearance">
1517
<mat-label>{{emailText}}</mat-label>
1618
<input matInput
1719
formControlName="email"
@@ -25,7 +27,8 @@
2527
</mat-error>
2628
</mat-form-field>
2729

28-
<mat-form-field [appearance]="appearance">
30+
<mat-form-field [@animate]="{value:'*',params:{duration:'300ms',y:'100px'}}"
31+
[appearance]="appearance">
2932
<mat-label>{{passwordText}}</mat-label>
3033
<input matInput [type]="togglePass.type" [minlength]="min" [maxlength]="max" formControlName="password"
3134
required/>
@@ -44,7 +47,8 @@
4447
</mat-error>
4548
</mat-form-field>
4649

47-
<button mat-raised-button
50+
<button [@animate]="{ value: '*', params: { x: '50px' } }"
51+
mat-raised-button
4852
style="margin-top: 20px"
4953
type="submit"
5054
class="space-top"
@@ -57,6 +61,7 @@
5761

5862
<div fxLayoutAlign="center">
5963
<button *ngIf="resetPasswordEnabled"
64+
[@animate]="{ value: '*', params: { x: '-50px' } }"
6065
mat-button
6166
class="space-top"
6267
[color]="color"
@@ -67,7 +72,8 @@
6772

6873
</mat-card-content>
6974
<mat-card-footer *ngIf="authProcess.isLoading">
70-
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
75+
<mat-progress-bar [@animate]="{ value: '*', params: { z: '50px', delay: '50ms', scale: '0.2' } }"
76+
mode="indeterminate"></mat-progress-bar>
7177
</mat-card-footer>
7278
</mat-card>
7379
</mat-tab>
@@ -79,11 +85,13 @@
7985
<div *ngIf="!authProcess.emailConfirmationSent;then register else confirm"></div>
8086
<ng-template #register>
8187
<mat-card-content fxLayout="column" fxLayoutAlign="center">
82-
<form [formGroup]="signUpFormGroup" (ngSubmit)="signUpFormGroup.valid &&
88+
<form [@animate]="{value:'*',params:{duration:'300ms',y:'100px'}}"
89+
[formGroup]="signUpFormGroup" (ngSubmit)="signUpFormGroup.valid &&
8390
processLegalSignUP(authProvider.EmailAndPassword)">
8491
<div fxLayout="column" fxLayoutAlign="center">
8592
<!--name-->
86-
<mat-form-field [appearance]="appearance">
93+
<mat-form-field [@animate]="{ value: '*', params: { x: '50px' } }"
94+
[appearance]="appearance">
8795
<!--labels will work only with @angular/material@6.2.0 -->
8896
<mat-label>{{nameText}}</mat-label>
8997
<input
@@ -108,7 +116,8 @@
108116
</mat-form-field>
109117

110118
<!--email-->
111-
<mat-form-field [appearance]="appearance">
119+
<mat-form-field [@animate]="{ value: '*', params: { x: '50px' } }"
120+
[appearance]="appearance">
112121
<mat-label>{{emailText}}</mat-label>
113122
<input matInput
114123
type="email"
@@ -125,7 +134,8 @@
125134

126135
<!--password-->
127136
<div fxLayout="column">
128-
<mat-form-field [appearance]="appearance">
137+
<mat-form-field [@animate]="{ value: '*', params: { x: '50px' } }"
138+
[appearance]="appearance">
129139
<mat-label>{{passwordText}}</mat-label>
130140
<input
131141
matInput
@@ -172,7 +182,8 @@
172182

173183
</div>
174184

175-
<button mat-raised-button
185+
<button [@animate]="{ value: '*', params: { x: '100px' } }"
186+
mat-raised-button
176187
style="margin-top: 20px"
177188
type="submit"
178189
[color]="color">
@@ -183,6 +194,7 @@
183194
</form>
184195

185196
<button *ngIf="guestEnabled"
197+
[@animate]="{ value: '*', params: { x: '-100px' } }"
186198
mat-button
187199
style="margin-top: 20px"
188200
[color]="color"
@@ -194,7 +206,8 @@
194206
</mat-card-content>
195207

196208
<mat-card-footer *ngIf="authProcess.isLoading">
197-
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
209+
<mat-progress-bar [@animate]="{ value: '*', params: { z: '50px', delay: '50ms', scale: '0.2' } }"
210+
mode="indeterminate"></mat-progress-bar>
198211
</mat-card-footer>
199212

200213
</ng-template>
@@ -213,7 +226,8 @@
213226

214227
<!--Reset password tab-->
215228
<mat-tab *ngIf="passwordResetWished" [label]="resetPasswordTabText">
216-
<form [formGroup]="resetPasswordFormGroup" (ngSubmit)="resetPasswordFormGroup.valid && resetPassword()">
229+
<form [@animateStagger]="{ value: '50' }"
230+
[formGroup]="resetPasswordFormGroup" (ngSubmit)="resetPasswordFormGroup.valid && resetPassword()">
217231

218232
<mat-card>
219233
<mat-card-header fxLayoutAlign="end">
@@ -227,7 +241,8 @@
227241
</mat-card-header>
228242

229243
<mat-card-content>
230-
<mat-form-field class="full-width" [appearance]="appearance">
244+
<mat-form-field class="full-width" [appearance]="appearance"
245+
[@animate]="{value:'*',params:{duration:'300ms',y:'100px'}}">
231246
<mat-label> {{ resetPasswordTabText }} </mat-label>
232247
<input matInput
233248
[readonly]="passReset"
@@ -244,18 +259,22 @@
244259
</mat-form-field>
245260
</mat-card-content>
246261
<mat-card-actions fxLayoutAlign="center">
247-
<button mat-raised-button
262+
<button [@animate]="{ value: '*', params: { x: '50px' } }"
263+
mat-raised-button
248264
type="submit"
249265
[color]="color"
250266
[disabled]="passReset">
251267
{{resetPasswordActionButtonText}}
252268
</button>
253269
</mat-card-actions>
254270
<mat-card-footer *ngIf="passReset" fxLayoutAlign="center">
255-
<p>{{resetPasswordInstructionsText}}</p>
271+
<p [@animate]="{ value: '*', params: { x: '-50px' } }">{{resetPasswordInstructionsText}}</p>
256272
</mat-card-footer>
257273
<mat-card-footer>
258-
<mat-progress-bar *ngIf="authProcess.isLoading" mode="indeterminate"></mat-progress-bar>
274+
<mat-progress-bar *ngIf="authProcess.isLoading"
275+
[@animate]="{ value: '*', params: { z: '50px', delay: '50ms', scale: '0.2' } }"
276+
mode="indeterminate">
277+
</mat-progress-bar>
259278
</mat-card-footer>
260279
</mat-card>
261280
</form>

src/module/components/ngx-auth-firebaseui/auth.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {LegalityDialogComponent} from '../../components/legality-dialog/legality
2424
import {LegalityDialogParams, LegalityDialogResult} from '../../interfaces/legality.dialog.intreface';
2525
import {NgxAuthFirebaseUIConfig, NgxAuthFirebaseUIConfigToken} from '../../ngx-auth-firebase-u-i.module';
2626
import {MatPasswordStrengthComponent} from '@angular-material-extensions/password-strength';
27+
import {NgxAuthFirebaseuiAnimations} from '../../animations';
2728

2829

2930
export const EMAIL_REGEX = new RegExp(['^(([^<>()[\\]\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\.,;:\\s@\"]+)*)',
@@ -36,7 +37,8 @@ export const PHONE_NUMBER_REGEX = new RegExp(/^\+(?:[0-9] ?){6,14}[0-9]$/);
3637
@Component({
3738
selector: 'ngx-auth-firebaseui',
3839
templateUrl: 'auth.component.html',
39-
styleUrls: ['auth.component.scss']
40+
styleUrls: ['auth.component.scss'],
41+
animations: NgxAuthFirebaseuiAnimations
4042
})
4143
export class AuthComponent implements OnInit, AfterViewInit, OnChanges, OnDestroy {
4244

0 commit comments

Comments
 (0)