aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/app/_elements/gradient-background
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/app/_elements/gradient-background')
-rw-r--r--frontend/src/app/_elements/gradient-background/gradient-background.component.css0
-rw-r--r--frontend/src/app/_elements/gradient-background/gradient-background.component.html1
-rw-r--r--frontend/src/app/_elements/gradient-background/gradient-background.component.spec.ts25
-rw-r--r--frontend/src/app/_elements/gradient-background/gradient-background.component.ts47
4 files changed, 73 insertions, 0 deletions
diff --git a/frontend/src/app/_elements/gradient-background/gradient-background.component.css b/frontend/src/app/_elements/gradient-background/gradient-background.component.css
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/frontend/src/app/_elements/gradient-background/gradient-background.component.css
diff --git a/frontend/src/app/_elements/gradient-background/gradient-background.component.html b/frontend/src/app/_elements/gradient-background/gradient-background.component.html
new file mode 100644
index 00000000..3f30c35e
--- /dev/null
+++ b/frontend/src/app/_elements/gradient-background/gradient-background.component.html
@@ -0,0 +1 @@
+<div #holder style="position: fixed; z-index: -1;" [ngStyle]="{'background': color}"></div> \ No newline at end of file
diff --git a/frontend/src/app/_elements/gradient-background/gradient-background.component.spec.ts b/frontend/src/app/_elements/gradient-background/gradient-background.component.spec.ts
new file mode 100644
index 00000000..969c73b7
--- /dev/null
+++ b/frontend/src/app/_elements/gradient-background/gradient-background.component.spec.ts
@@ -0,0 +1,25 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { GradientBackgroundComponent } from './gradient-background.component';
+
+describe('GradientBackgroundComponent', () => {
+ let component: GradientBackgroundComponent;
+ let fixture: ComponentFixture<GradientBackgroundComponent>;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [ GradientBackgroundComponent ]
+ })
+ .compileComponents();
+ });
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(GradientBackgroundComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/frontend/src/app/_elements/gradient-background/gradient-background.component.ts b/frontend/src/app/_elements/gradient-background/gradient-background.component.ts
new file mode 100644
index 00000000..1414bc60
--- /dev/null
+++ b/frontend/src/app/_elements/gradient-background/gradient-background.component.ts
@@ -0,0 +1,47 @@
+import { AfterViewInit, Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core';
+
+@Component({
+ selector: 'app-gradient-background',
+ templateUrl: './gradient-background.component.html',
+ styleUrls: ['./gradient-background.component.css']
+})
+export class GradientBackgroundComponent implements AfterViewInit {
+
+ @ViewChild('holder') holderRef!: ElementRef;
+ private holder!: HTMLDivElement;
+
+
+ @Input() colorHorizontal1 = 'rgba(0, 8, 45, 0.5)';
+ @Input() colorHorizontal2 = 'rgba(0, 52, 89, 0.5)';
+
+ @Input() colorVertical1 = 'rgba(0, 52, 89, 0.5)';
+ @Input() colorVertical2 = 'rgba(0, 152, 189, 0.5)';
+
+ constructor() { }
+
+ color: string = this.gradientHorizontal();
+
+ private width = 0;
+ private height = 0;
+
+ gradientHorizontal(): string {
+ return `linear-gradient(90deg, ${this.colorHorizontal1} 0%, ${this.colorHorizontal2} 50%, ${this.colorHorizontal1} 100%), linear-gradient(0deg, ${this.colorVertical1} 0%, ${this.colorVertical2} 100%)`;
+ }
+
+ resize() {
+ this.width = window.innerWidth;
+ this.height = window.innerHeight;
+
+ this.holder.style.width = this.width + 'px';
+ this.holder.style.height = this.height + 'px';
+ }
+
+ ngAfterViewInit(): void {
+ this.holder = <HTMLDivElement>this.holderRef.nativeElement;
+
+ window.addEventListener('resize', () => this.resize());
+ this.resize();
+
+ }
+
+}