Initial Commit

This commit is contained in:
ItzMineyy committed 2024-12-20 01:59:53 +01:00
1 parent ae0db346a0
commit 06bc03176b
55 files changed
+1442 -346

No files matched your search

+48
View File
@@ -0,0 +1,48 @@
#vanta-not-found-bg {
transition: opacity 0.3s ease-in-out;
position: fixed;
top: 0;
left: 0;
width: 100vw; /* Full viewport width */
height: 100vh; /* Full viewport height */
z-index: -100; /* Place the background behind content */
}
.container {
display: flex;
height: 100%;
justify-content: center;
align-items: center;
text-align: center;
z-index: 10; /* Ensure the text and button are above the canvas */
}
.error-message h1 {
font-size: 10rem;
margin: 0;
font-weight: 700;
color: white;
}
.error-message p {
font-size: 1.5rem;
margin: 20px 0;
font-weight: 400;
color: white;
}
button {
background-color: #713252;
color: #fff;
border: none;
padding: 10px 20px;
font-size: 1rem;
cursor: pointer;
border-radius: 5px;
transition: background-color 0.3s;
font-weight: 400;
}
button:hover {
background-color: #bf9bae;
}
@@ -0,0 +1,8 @@
<div id="vanta-not-found-bg"></div>
<div class="container" id="container">
<div class="error-message">
<h1>404</h1>
<p>Oops! You got lost in space.</p>
<a href="/"><button id="reloadButton">Take me Home!</button></a>
</div>
</div>
@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NotFoundComponent } from './not-found.component';
describe('NotFoundComponent', () => {
let component: NotFoundComponent;
let fixture: ComponentFixture<NotFoundComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [NotFoundComponent]
})
.compileComponents();
fixture = TestBed.createComponent(NotFoundComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
+70
View File
@@ -0,0 +1,70 @@
import {Component, OnInit, OnDestroy, AfterViewInit } from '@angular/core';
import {Meta, Title} from '@angular/platform-browser';
@Component({
selector: 'app-not-found',
imports: [],
templateUrl: './not-found.component.html',
styleUrl: './not-found.component.css',
})
export class NotFoundComponent implements OnInit, OnDestroy, AfterViewInit {
constructor(private titleService: Title, private meta: Meta) {}
private vantaEffect: any;
ngOnInit() {
this.titleService.setTitle('404 Not Found');
this.meta.updateTag({ name: 'description', content: 'How the hell did you end up here?' });
this.meta.updateTag({ property: 'og:image', content: 'https://itzminey.dev/assets/ogimg.png' });
window.addEventListener('resize', this.onResize.bind(this)); // Add resize listener for responsiveness
const bgElement = document.getElementById('vanta-not-found-bg');
if (bgElement) {
bgElement.style.position = 'fixed';
}
}
ngAfterViewInit() {
this.initVanta();
this.resizeVanta();
}
ngOnDestroy() {
if (this.vantaEffect) {
this.vantaEffect.destroy(); // Clean up the effect on destroy
}
window.removeEventListener('resize', this.onResize); // Remove the listener when the component is destroyed
}
initVanta() {
// Initialize the Vanta effect on the element with ID 'vanta-bg'
this.vantaEffect = window.VANTA.NET({
el: '#vanta-not-found-bg',
mouseControls: true,
touchControls: true,
gyroControls: false,
scale: 1.00,
scaleMobile: 1.00,
points: 20.00,
maxDistance: 25.00,
spacing: 18.00,
showDots: false,
minWidth: window.innerWidth,
minHeight: window.innerHeight,
color: 0xac1f4e,
backgroundColor: 0x191522
});
}
onResize() {
// Update the minHeight and minWidth when the window is resized
this.resizeVanta();
}
resizeVanta() {
if (this.vantaEffect) {
// Trigger the resize on the vanta effect
this.vantaEffect.resize();
}
}
}