moving the loading dialog to component

This commit is contained in:
Chneemann 2024-05-20 09:34:37 +02:00
parent aa7176aaef
commit 4068aecb7a
9 changed files with 106 additions and 65 deletions

View file

@ -0,0 +1,13 @@
@if (sharedService.isBtnDisabled) {
<div class="loading-dialog">
<div id="loading" class="loader"></div>
<div id="loadingText" class="loading-text">
<p>
{{ "login.loginDialog0" | translate }}
</p>
<p>
{{ "login.loginDialog1" | translate }}
</p>
</div>
</div>
}

View file

@ -0,0 +1,49 @@
.loading-dialog {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
width: 100vw;
height: 100vh;
backdrop-filter: blur(5px);
background-color: rgba($color: #000, $alpha: 0.2);
display: flex;
justify-content: center;
align-items: center;
z-index: 999;
}
.loader {
position: fixed;
border: 16px solid var(--white);
border-top: 16px solid var(--light-blue);
border-radius: 50%;
width: 50px;
height: 50px;
animation: spin 2s linear infinite;
margin: auto;
margin-top: 20px;
}
.loading-text {
position: fixed;
text-align: center;
margin-top: 200px;
color: var(--white);
text-shadow: 3px 3px 3px var(--black);
p {
font-size: 21px;
font-weight: 400px;
margin-bottom: 6px;
}
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}

View file

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { LoadingDialogComponent } from './loading-dialog.component';
describe('LoadingDialogComponent', () => {
let component: LoadingDialogComponent;
let fixture: ComponentFixture<LoadingDialogComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [LoadingDialogComponent]
})
.compileComponents();
fixture = TestBed.createComponent(LoadingDialogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View file

@ -0,0 +1,14 @@
import { Component } from '@angular/core';
import { SharedService } from '../../../services/shared.service';
import { TranslateModule } from '@ngx-translate/core';
@Component({
selector: 'app-loading-dialog',
standalone: true,
imports: [TranslateModule],
templateUrl: './loading-dialog.component.html',
styleUrl: './loading-dialog.component.scss',
})
export class LoadingDialogComponent {
constructor(public sharedService: SharedService) {}
}

View file

@ -108,16 +108,4 @@
</form> </form>
<app-footer></app-footer> <app-footer></app-footer>
</section> </section>
@if (sharedService.isBtnDisabled) { <app-loading-dialog></app-loading-dialog>
<div class="loading-dialog">
<div id="loading" class="loader"></div>
<div id="loadingText" class="loading-text">
<p>
{{ "login.loginDialog0" | translate }}
</p>
<p>
{{ "login.loginDialog1" | translate }}
</p>
</div>
</div>
}

View file

@ -87,58 +87,6 @@ section {
padding: 12px 0; padding: 12px 0;
} }
/*------------- LOADER -------------*/
.loading-dialog {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
width: 100vw;
height: 100vh;
backdrop-filter: blur(5px);
background-color: rgba($color: #000, $alpha: 0.2);
display: flex;
justify-content: center;
align-items: center;
z-index: 999;
}
.loader {
position: fixed;
border: 16px solid var(--white);
border-top: 16px solid var(--light-blue);
border-radius: 50%;
width: 50px;
height: 50px;
animation: spin 2s linear infinite;
margin: auto;
margin-top: 20px;
}
.loading-text {
position: fixed;
text-align: center;
margin-top: 200px;
color: var(--white);
text-shadow: 3px 3px 3px var(--black);
p {
font-size: 21px;
font-weight: 400px;
margin-bottom: 6px;
}
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
/*------------- RESPONSIVE -------------*/ /*------------- RESPONSIVE -------------*/
@media (max-height: 800px) { @media (max-height: 800px) {

View file

@ -9,6 +9,7 @@ import { SharedService } from '../../services/shared.service';
import { FooterComponent } from './footer/footer.component'; import { FooterComponent } from './footer/footer.component';
import { HeaderComponent } from './header/header.component'; import { HeaderComponent } from './header/header.component';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { LoadingDialogComponent } from './loading-dialog/loading-dialog.component';
@Component({ @Component({
selector: 'app-login', selector: 'app-login',
@ -20,6 +21,7 @@ import { TranslateModule } from '@ngx-translate/core';
FooterComponent, FooterComponent,
HeaderComponent, HeaderComponent,
TranslateModule, TranslateModule,
LoadingDialogComponent,
], ],
templateUrl: './login.component.html', templateUrl: './login.component.html',
styleUrl: './login.component.scss', styleUrl: './login.component.scss',

View file

@ -170,6 +170,7 @@
!registerData.mail || !registerData.mail ||
password.invalid || password.invalid ||
!registerData.password || !registerData.password ||
!checkbox.valid ||
sharedService.isBtnDisabled || sharedService.isBtnDisabled ||
registerData.password.length < 6 || registerData.password.length < 6 ||
registerData.password !== registerData.passwordConfirm || registerData.password !== registerData.passwordConfirm ||
@ -181,3 +182,4 @@
</form> </form>
<app-footer></app-footer> <app-footer></app-footer>
</section> </section>
<app-loading-dialog></app-loading-dialog>

View file

@ -10,6 +10,7 @@ import { SharedService } from '../../../services/shared.service';
import { BtnBackComponent } from '../../../shared/components/buttons/btn-back/btn-back.component'; import { BtnBackComponent } from '../../../shared/components/buttons/btn-back/btn-back.component';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { LoadingDialogComponent } from '../loading-dialog/loading-dialog.component';
@Component({ @Component({
selector: 'app-register', selector: 'app-register',
@ -23,6 +24,7 @@ import { TranslateModule, TranslateService } from '@ngx-translate/core';
CommonModule, CommonModule,
RouterModule, RouterModule,
TranslateModule, TranslateModule,
LoadingDialogComponent,
], ],
templateUrl: './register.component.html', templateUrl: './register.component.html',
styleUrl: './register.component.scss', styleUrl: './register.component.scss',