added registration component

This commit is contained in:
2020-07-21 08:46:11 +02:00
parent 46ce0ddbff
commit 2cf55e6709
4 changed files with 119 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
.register-card {
width: 400px;
}
.register-container {
width: 100%;
height: 100%;
background-color: #333333;
}
.register-form {
padding: 10px 40px;
}
.mat-button {
width: 80px;
}
.mat-form-field {
width: 100%;
padding-top: 15px;
}

View File

@@ -0,0 +1,47 @@
<div class="register-container" fxLayout="row" fxLayoutAlign="center center">
<mat-card class="register-card" fxLayout="column" fxLayoutAlign="center center">
<mat-card-title>Sign up</mat-card-title>
<mat-card-content>
<form class="register-form" [formGroup]="form" (ngSubmit)="onRegister()">
<mat-form-field appearance="fill">
<mat-label>User name</mat-label>
<label>
<input matInput formControlName="username" required>
</label>
</mat-form-field>
<mat-form-field appearance="fill">
<mat-label>Email</mat-label>
<label>
<input matInput formControlName="email" required email>
</label>
</mat-form-field>
<!--<div formGroupName="passwordGroup">-->
<mat-form-field appearance="fill" hintLabel="At least 15 characters.">
<mat-label>Password</mat-label>
<label>
<input matInput formControlName="password" type="password" required minlength="15">
</label>
</mat-form-field>
<mat-form-field appearance="fill">
<mat-label>Confirm password</mat-label>
<label>
<input matInput formControlName="password2" type="password" required minlength="15"
[errorStateMatcher]="">
</label>
</mat-form-field>
<!--</div>-->
<div fxLayout="row" fxLayoutAlign="space-evenly center">
<a mat-button href="/login">Login</a>
<button [disabled]="loading" class="mat-button">
<span *ngIf="loading" class="spinner-border spinner-border-sm mr-1"></span>
Sign up
</button>
</div>
</form>
</mat-card-content>
</mat-card>
</div>

View File

@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RegisterComponent } from './register.component';
describe('RegisterComponent', () => {
let component: RegisterComponent;
let fixture: ComponentFixture<RegisterComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ RegisterComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(RegisterComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,25 @@
import { Component, OnInit } from '@angular/core';
import {EmailValidator, FormControl, FormGroup} from '@angular/forms';
@Component({
selector: 'app-register',
templateUrl: './register.component.html',
styleUrls: ['./register.component.css']
})
export class RegisterComponent implements OnInit {
form: FormGroup = new FormGroup({
username: new FormControl(''),
email: new FormControl(''),
password: new FormControl(''),
password2: new FormControl(''),
});
loading = false;
onRegister() {
this.loading = !this.loading;
}
constructor() { }
ngOnInit(): void { }
}