Skip to content

Commit d1f1724

Browse files
committed
fix(package): improved ngx-auth-firebaseui-register + i18n support
1 parent 09951a1 commit d1f1724

File tree

2 files changed

+45
-26
lines changed

2 files changed

+45
-26
lines changed

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

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,76 @@
11
<div fxLayout="column" id="register">
22
<div fxLayout="column" fxLayoutAlign="center center" id="register-form-wrapper">
3-
<div [@animate]="{ value: '*', params: { duration: '300ms', y: '100px' } }" id="register-form">
4-
<div class="logo">
5-
<img src="assets/images/logos/fuse.svg" />
3+
<div id="register-form" [@animateStagger]="{ value: '50' }">
4+
5+
<div *ngIf="logoUrl" class="logo">
6+
<img [src]="logoUrl" alt="logo" [@animate]="{ value: '*', params: { x: '50px' } }">
67
</div>
78

8-
<div class="title">CREATE AN ACCOUNT</div>
9+
<div class="title" [@animate]="{ value: '*', params: { x: '-50px' } }">{{titleText}}</div>
910

1011
<form [formGroup]="registerForm" name="registerForm" novalidate>
11-
<mat-form-field>
12-
<input formControlName="name" matInput placeholder="Name" />
12+
<mat-form-field [appearance]="appearance" [@animate]="{ value: '*', params: { x: '50px' } }">
13+
<input formControlName="name" matInput placeholder="Name"/>
1314
<mat-icon matSuffix color="primary">person</mat-icon>
1415
<mat-error>
1516
Name is required
1617
</mat-error>
1718
</mat-form-field>
1819

19-
<mat-form-field>
20-
<input formControlName="email" matInput placeholder="Email" />
20+
<mat-form-field [appearance]="appearance" [@animate]="{ value: '*', params: { x: '50px' } }">
21+
<input formControlName="email" matInput [placeholder]="emailText"/>
2122
<mat-icon matSuffix color="primary">email</mat-icon>
2223
<mat-error *ngIf="registerForm.get('email').hasError('required')">
23-
Email is required
24+
{{emailErrorRequiredText}}
2425
</mat-error>
2526
<mat-error *ngIf="registerForm.get('email').hasError('email')">
26-
Please enter a valid email address
27+
{{emailErrorPatternText}}
2728
</mat-error>
2829
</mat-form-field>
2930

30-
<mat-form-field>
31-
<input formControlName="password" matInput placeholder="Password" type="password" />
31+
<mat-form-field [appearance]="appearance" [@animate]="{ value: '*', params: { x: '50px' } }">
32+
<input formControlName="password" matInput [placeholder]="passwordText" type="password"/>
3233
<mat-icon matSuffix color="primary">lock</mat-icon>
3334
<mat-error>
34-
Password is required
35+
{{passwordErrorRequiredText}}
3536
</mat-error>
3637
</mat-form-field>
3738

38-
<mat-form-field>
39-
<input formControlName="passwordConfirm" matInput placeholder="Password (Confirm)" type="password" />
39+
<mat-form-field [appearance]="appearance" [@animate]="{ value: '*', params: { x: '50px' } }">
40+
<input formControlName="passwordConfirm" matInput [placeholder]="passwordConfirmationText" type="password"/>
4041
<mat-icon matSuffix color="primary">lock</mat-icon>
4142
<mat-error *ngIf="registerForm.get('passwordConfirm').hasError('required')">
42-
Password confirmation is required
43+
{{passwordConfirmationErrorRequiredText}}
4344
</mat-error>
4445
<mat-error
4546
*ngIf="
4647
!registerForm.get('passwordConfirm').hasError('required') &&
4748
registerForm.get('passwordConfirm').hasError('passwordsNotMatching')
48-
"
49-
>
50-
Passwords must match
49+
">
50+
{{passwordErrorMatchText}}
5151
</mat-error>
5252
</mat-form-field>
5353

5454
<div class="terms" fxLayout="row" fxLayoutAlign="center center">
5555
<mat-checkbox aria-label="I read and accept" name="terms" required>
56-
<span>I read and accept</span>
56+
<span>{{readAncAcceptText}}</span>
5757
</mat-checkbox>
58-
<a href="#">terms and conditions</a>
58+
<button mat-button color="primary">{{termsAndConditionsText}}</button>
5959
</div>
6060

6161
<button
6262
[disabled]="registerForm.invalid"
6363
aria-label="CREATE AN ACCOUNT"
6464
class="submit-button"
6565
color="accent"
66-
mat-raised-button
67-
>
68-
CREATE AN ACCOUNT
66+
mat-raised-button>
67+
{{createAccountButtonText}}
6968
</button>
7069
</form>
7170

7271
<div class="register" fxLayout="column" fxLayoutAlign="center center">
73-
<span class="text">Already have an account?</span>
74-
<a [routerLink]="'/pages/auth/login'" class="link">Login</a>
72+
<span class="text">{{alreadyHaveAccountText}}</span>
73+
<button mat-button color="accent">{{loginButtonText}}</button>
7574
</div>
7675
</div>
7776
</div>

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,26 @@ export class NgxAuthFirebaseuiRegisterComponent implements OnInit, OnDestroy {
4040
@Input() logoUrl: string;
4141
@Input() appearance: MatFormFieldAppearance;
4242

43+
// i18n common
44+
@Input() titleText = 'CREATE AN ACCOUNT';
45+
@Input() readAncAcceptText = 'I read and accept';
46+
@Input() termsAndConditionsText = 'terms and conditions';
47+
@Input() createAccountButtonText = 'CREATE AN ACCOUNT';
48+
@Input() alreadyHaveAccountText = 'Already have an account?';
49+
@Input() loginButtonText = 'LOGIN';
50+
51+
// i18n email
52+
@Input() emailText = 'Email';
53+
@Input() emailErrorRequiredText = 'Email is required';
54+
@Input() emailErrorPatternText = 'Please enter a valid email address';
55+
56+
// i18n password
57+
@Input() passwordText = 'Password';
58+
@Input() passwordErrorRequiredText = 'Password is required';
59+
@Input() passwordConfirmationText = 'Password Confirmation';
60+
@Input() passwordConfirmationErrorRequiredText = 'Password confirmation is required';
61+
@Input() passwordErrorMatchText = 'Password must match';
62+
4363
registerForm: FormGroup;
4464

4565
// Private

0 commit comments

Comments
 (0)