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,12 +1,14 @@
|
|||
import { ChangeDetectionStrategy, Component, inject, OnDestroy, OnInit } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, Component, inject, OnDestroy, OnInit, signal } from '@angular/core';
|
||||
import { NgFor } from '@angular/common';
|
||||
import { RouterLink } from '@angular/router';
|
||||
import { AuthService } from '@service/auth.service';
|
||||
import { LoginComponent } from '../auth/login/login.component';
|
||||
import { RegisterComponent } from '../auth/register/register.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-landing-page',
|
||||
standalone: true,
|
||||
imports: [NgFor, RouterLink],
|
||||
imports: [NgFor, RouterLink, LoginComponent, RegisterComponent],
|
||||
templateUrl: './landing.component.html',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
|
@ -14,13 +16,35 @@ export class LandingComponent implements OnInit, OnDestroy {
|
|||
currentSlide = 0;
|
||||
private autoplayInterval: ReturnType<typeof setInterval> | undefined;
|
||||
authService: AuthService = inject(AuthService);
|
||||
showLogin = signal(false);
|
||||
showRegister = signal(false);
|
||||
|
||||
ngOnInit() {
|
||||
this.startAutoplay();
|
||||
document.body.style.overflow = 'auto';
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.stopAutoplay();
|
||||
document.body.style.overflow = 'auto';
|
||||
}
|
||||
|
||||
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';
|
||||
}
|
||||
|
||||
prevSlide() {
|
||||
|
|
Reference in a new issue