add loggin in animation

This commit is contained in:
Constantin Simonis 2025-01-09 13:41:34 +01:00
parent f33082343c
commit 77520fb54e
Signed by: csimonis
GPG Key ID: 758DD9C506603183
4 changed files with 25 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import {HomeComponent} from "./home/home.component";
export const routes: Routes = [ export const routes: Routes = [
{path: 'login', component: LoginComponent}, {path: 'login', component: LoginComponent},
{path: 'test', component: LoginComponent},
{path: '', component: HomeComponent, canActivate: [AuthGuardService]}, {path: '', component: HomeComponent, canActivate: [AuthGuardService]},
{path: '**', redirectTo: ''} {path: '**', redirectTo: ''}
]; ];

View File

@ -0,0 +1,6 @@
.dot-loader {
font-size: 1.5rem;
font-weight: bold;
color: #555;
text-align: center;
}

View File

@ -1 +1 @@
<p>login works!</p> <div class="dot-loader">Logging in<span>{{ dots }}</span></div>

View File

@ -1,4 +1,5 @@
import { Component } from '@angular/core'; import {Component, OnDestroy, OnInit} from '@angular/core';
import {interval, Subscription} from "rxjs";
@Component({ @Component({
selector: 'app-login', selector: 'app-login',
@ -7,6 +8,20 @@ import { Component } from '@angular/core';
standalone: true, standalone: true,
styleUrl: './login.component.css' styleUrl: './login.component.css'
}) })
export class LoginComponent { export class LoginComponent implements OnInit, OnDestroy{
dots: string = '';
private maxDots: number = 4; // Maximum number of dots
private intervalSub!: Subscription;
ngOnInit(): void {
this.intervalSub = interval(500).subscribe(() => {
this.dots = this.dots.length < this.maxDots ? this.dots + '.' : '';
});
}
ngOnDestroy(): void {
if (this.intervalSub) {
this.intervalSub.unsubscribe();
}
}
} }