feat(auth): add login and registration modal functionality
This commit is contained in:
parent
5bbfa5994e
commit
0079ee7bf2
11 changed files with 212 additions and 55 deletions
|
@ -1,16 +1,44 @@
|
|||
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component, HostListener, signal } from '@angular/core';
|
||||
import { RouterOutlet } from '@angular/router';
|
||||
import { FooterComponent } from '@shared/components/footer/footer.component';
|
||||
import { NavbarComponent } from '@shared/components/navbar/navbar.component';
|
||||
import { NavbarComponent } from './shared/components/navbar/navbar.component';
|
||||
import { FooterComponent } from './shared/components/footer/footer.component';
|
||||
import { LoginComponent } from './feature/auth/login/login.component';
|
||||
import { RegisterComponent } from './feature/auth/register/register.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
standalone: true,
|
||||
imports: [CommonModule, RouterOutlet, FooterComponent, NavbarComponent],
|
||||
providers: [],
|
||||
imports: [RouterOutlet, NavbarComponent, FooterComponent, LoginComponent, RegisterComponent],
|
||||
templateUrl: './app.component.html',
|
||||
styleUrl: './app.component.css',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class AppComponent {}
|
||||
export class AppComponent {
|
||||
showLogin = signal(false);
|
||||
showRegister = signal(false);
|
||||
|
||||
@HostListener('document:keydown.escape')
|
||||
handleEscapeKey() {
|
||||
this.hideAuthForms();
|
||||
}
|
||||
|
||||
showLoginForm() {
|
||||
this.showLogin.set(true);
|
||||
this.showRegister.set(false);
|
||||
document.body.style.overflow = 'hidden';
|
||||
}
|
||||
|
||||
showRegisterForm() {
|
||||
this.showRegister.set(true);
|
||||
this.showLogin.set(false);
|
||||
document.body.style.overflow = 'hidden';
|
||||
}
|
||||
|
||||
hideAuthForms() {
|
||||
this.showLogin.set(false);
|
||||
this.showRegister.set(false);
|
||||
document.body.style.overflow = 'auto';
|
||||
}
|
||||
|
||||
stopPropagation(event: MouseEvent) {
|
||||
event.stopPropagation();
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue