diff --git a/libs/blog/feature-home/src/lib/blog-home.component.html b/libs/blog/feature-home/src/lib/blog-home.component.html index 3fe4e6a..f754a97 100644 --- a/libs/blog/feature-home/src/lib/blog-home.component.html +++ b/libs/blog/feature-home/src/lib/blog-home.component.html @@ -57,7 +57,7 @@

+ @if (loading) { +
+ } + + Valery Melou +
diff --git a/libs/shared/layout/src/lib/logo/logo.component.spec.ts b/libs/shared/layout/src/lib/logo/logo.component.spec.ts new file mode 100644 index 0000000..6cf6022 --- /dev/null +++ b/libs/shared/layout/src/lib/logo/logo.component.spec.ts @@ -0,0 +1,21 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { LogoComponent } from './logo.component'; + +describe('LogoComponent', () => { + let component: LogoComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [LogoComponent], + }).compileComponents(); + + fixture = TestBed.createComponent(LogoComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/libs/shared/layout/src/lib/logo/logo.component.ts b/libs/shared/layout/src/lib/logo/logo.component.ts new file mode 100644 index 0000000..4137af2 --- /dev/null +++ b/libs/shared/layout/src/lib/logo/logo.component.ts @@ -0,0 +1,143 @@ +import { Component } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { + NavigationEnd, + NavigationStart, + RouteConfigLoadEnd, + RouteConfigLoadStart, + Router, +} from '@angular/router'; + +@Component({ + selector: 'app-logo', + standalone: true, + imports: [CommonModule], + templateUrl: './logo.component.html', + styles: ` + /* HTML:
*/ + .loader { + width: 40px; + aspect-ratio: 1; + border-radius: 50%; + border: 2px solid #3754ed; + animation: + l20-1 0.8s infinite linear alternate, + l20-2 1.6s infinite linear; + } + + @keyframes l20-1 { + 0% { + clip-path: polygon( + 50% 50%, + 0 0, + 50% 0%, + 50% 0%, + 50% 0%, + 50% 0%, + 50% 0% + ); + } + 12.5% { + clip-path: polygon( + 50% 50%, + 0 0, + 50% 0%, + 100% 0%, + 100% 0%, + 100% 0%, + 100% 0% + ); + } + 25% { + clip-path: polygon( + 50% 50%, + 0 0, + 50% 0%, + 100% 0%, + 100% 100%, + 100% 100%, + 100% 100% + ); + } + 50% { + clip-path: polygon( + 50% 50%, + 0 0, + 50% 0%, + 100% 0%, + 100% 100%, + 50% 100%, + 0% 100% + ); + } + 62.5% { + clip-path: polygon( + 50% 50%, + 100% 0, + 100% 0%, + 100% 0%, + 100% 100%, + 50% 100%, + 0% 100% + ); + } + 75% { + clip-path: polygon( + 50% 50%, + 100% 100%, + 100% 100%, + 100% 100%, + 100% 100%, + 50% 100%, + 0% 100% + ); + } + 100% { + clip-path: polygon( + 50% 50%, + 50% 100%, + 50% 100%, + 50% 100%, + 50% 100%, + 50% 100%, + 0% 100% + ); + } + } + @keyframes l20-2 { + 0% { + transform: scaleY(1) rotate(0deg); + } + 49.99% { + transform: scaleY(1) rotate(135deg); + } + 50% { + transform: scaleY(-1) rotate(0deg); + } + 100% { + transform: scaleY(-1) rotate(-135deg); + } + } + `, +}) +export class LogoComponent { + loading = false; + + constructor(router: Router) { + router.events.subscribe({ + next: (event) => { + if ( + event instanceof NavigationStart || + event instanceof RouteConfigLoadStart + ) { + this.loading = true; + } else if ( + event instanceof NavigationEnd || + event instanceof RouteConfigLoadEnd + ) { + this.loading = false; + } + }, + }); + } +} diff --git a/libs/shared/layout/src/lib/navbar/navbar.component.html b/libs/shared/layout/src/lib/navbar/navbar.component.html index 009376e..3d4d2d7 100644 --- a/libs/shared/layout/src/lib/navbar/navbar.component.html +++ b/libs/shared/layout/src/lib/navbar/navbar.component.html @@ -1,13 +1,5 @@
- - Valery Melou - +