add animation to login
Reviewed-on: #28 Reviewed-by: Get in my car i have candy <huydw@proton.me>
This commit is contained in:
parent
f33082343c
commit
89bea09476
@ -0,0 +1,6 @@
|
||||
.dot-loader {
|
||||
font-size: 1.5rem;
|
||||
font-weight: bold;
|
||||
color: #555;
|
||||
text-align: center;
|
||||
}
|
@ -1 +1 @@
|
||||
<p>login works!</p>
|
||||
<div class="dot-loader">Logging in<span>{{ dots }}</span></div>
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { Component } from '@angular/core';
|
||||
import {Component, OnDestroy, OnInit} from '@angular/core';
|
||||
import {interval, Subscription} from "rxjs";
|
||||
|
||||
@Component({
|
||||
selector: 'app-login',
|
||||
@ -7,6 +8,20 @@ import { Component } from '@angular/core';
|
||||
standalone: true,
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user