diff --git a/.eslintrc.json b/.eslintrc.json index 30fe745..f25be8f 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -85,7 +85,8 @@ "prefix": "app", "style": "kebab-case" } - ] + ], + "@typescript-eslint/unbound-method": "off" }, "settings": { "import/resolver": { diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts index 704c8d0..2fbe42e 100644 --- a/src/app/app.routes.ts +++ b/src/app/app.routes.ts @@ -1,5 +1,7 @@ import { Routes } from '@angular/router'; -const routes: Routes = []; +import { RegisterComponent } from './auth/pages/register/register.component'; + +const routes: Routes = [{ path: 'register', component: RegisterComponent }]; export default routes; diff --git a/src/app/auth/pages/register/register.component.html b/src/app/auth/pages/register/register.component.html index 6b0ba2e..1cc3c94 100644 --- a/src/app/auth/pages/register/register.component.html +++ b/src/app/auth/pages/register/register.component.html @@ -1 +1,36 @@ -

register works!

+
+
+

Sign Up

+ + Email + + + + + + + + + Password + + + + + + + + + Repeat Password + + + + + + + + + + Sign In + +
+
diff --git a/src/app/auth/pages/register/register.component.scss b/src/app/auth/pages/register/register.component.scss index e69de29..4f174a0 100644 --- a/src/app/auth/pages/register/register.component.scss +++ b/src/app/auth/pages/register/register.component.scss @@ -0,0 +1,57 @@ +.register-container { + display: flex; + justify-content: center; + height: 100%; +} + +.register-form { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + + width: 25rem; + height: 32rem; + margin: auto; + padding: 2rem; + + background-color: #c7c7c724; + box-shadow: 0 0 10px 0 rgb(0 0 0 / 30%); + + .register-form-item { + display: flex; + flex-direction: column; + margin-bottom: 3.5rem; + + nz-form-label { + text-align: left; + } + + nz-form-label, + nz-form-control { + width: 100%; + } + } + + .register-button-container { + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + + margin-top: 1rem; + + text-align: center; + } +} + +@media screen and (width <= 575px) { + .register-form { + height: auto; + padding: 1.5rem; + + .register-form-item { + margin-bottom: 1rem; + } + } +} diff --git a/src/app/auth/pages/register/register.component.ts b/src/app/auth/pages/register/register.component.ts index 7bb7c24..4d96ec3 100644 --- a/src/app/auth/pages/register/register.component.ts +++ b/src/app/auth/pages/register/register.component.ts @@ -1,11 +1,48 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; +import { FormBuilder, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms'; + +import { NzButtonModule } from 'ng-zorro-antd/button'; +import { NzFormModule } from 'ng-zorro-antd/form'; +import { NzInputModule } from 'ng-zorro-antd/input'; +import { NzMessageService } from 'ng-zorro-antd/message'; @Component({ selector: 'app-register', standalone: true, - imports: [], + imports: [ReactiveFormsModule, NzFormModule, NzInputModule, NzButtonModule], templateUrl: './register.component.html', styleUrl: './register.component.scss', changeDetection: ChangeDetectionStrategy.OnPush, }) -export class RegisterComponent {} +export class RegisterComponent { + public validateForm!: FormGroup; + + constructor( + private fb: FormBuilder, + private message: NzMessageService, + ) { + this.validateForm = this.fb.group({ + email: [null, [Validators.email, Validators.required]], + password: [null, [Validators.required]], + confirm: [null, [Validators.required]], + }); + } + + public submitForm(): void { + if (this.validateForm.valid) { + // Perform registration logic here (e.g., send data to backend) + // console.log('submit', this.validateForm.value); + this.message.success('Registration successful!'); + this.validateForm.reset(); + } else { + Object.values(this.validateForm.controls).forEach((control) => { + if (control.invalid) { + control.markAsDirty(); + control.updateValueAndValidity({ + onlySelf: true, + }); + } + }); + } + } +}