Added image fullscreen modals and style updates

This commit is contained in:
itzMiney committed 2025-08-18 21:40:34 +02:00
1 parent 659ab2a975
commit 5bbadfef1c
7 files changed
+231 -58

No files matched your search

+2 -2
View File
@@ -1,5 +1,5 @@
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {NgIf} from '@angular/common'; import {CommonModule} from '@angular/common';
import {ActivatedRoute, Router, RouterOutlet} from '@angular/router'; import {ActivatedRoute, Router, RouterOutlet} from '@angular/router';
import {NavbarComponent} from './shared/navbar/navbar.component'; import {NavbarComponent} from './shared/navbar/navbar.component';
import {MobileNavbarComponent} from './shared/mobile-navbar/mobile-navbar.component'; import {MobileNavbarComponent} from './shared/mobile-navbar/mobile-navbar.component';
@@ -9,7 +9,7 @@ import {TranslateService} from '@ngx-translate/core';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
imports: [RouterOutlet, NavbarComponent, FooterComponent, MobileNavbarComponent, NgIf], imports: [RouterOutlet, NavbarComponent, FooterComponent, MobileNavbarComponent, CommonModule],
templateUrl: './app.component.html', templateUrl: './app.component.html',
styleUrl: './app.component.css', styleUrl: './app.component.css',
}) })
@@ -133,6 +133,62 @@ h1 {
animation: spin 1s linear infinite; animation: spin 1s linear infinite;
} }
::ng-deep img {
max-width: 900px;
padding: 15px;
border-radius: 35px;
height: auto;
}
::ng-deep .gallery {
display: grid;
max-width: 900px;
grid-template-columns: repeat(3, 1fr);
gap: 15px;
margin: auto;
padding: 15px;
}
::ng-deep .gallery img {
width: 100%;
height: auto;
border-radius: 20px;
object-fit: cover;
}
::ng-deep .modal {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: rgba(0,0,0,0.5);
display: flex;
justify-content: center;
align-items: center;
animation: fadeIn 0.3s ease forwards;
z-index: 1000;
cursor: pointer;
}
::ng-deep .modal img {
max-width: 80%;
max-height: 80%;
border-radius: 20px;
object-fit: contain;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: scale(0.95); /* optional: slight zoom effect */
}
to {
opacity: 1;
transform: scale(1);
}
}
@keyframes spin { @keyframes spin {
0% { 0% {
transform: rotate(0deg); transform: rotate(0deg);
@@ -141,3 +197,15 @@ h1 {
transform: rotate(360deg); transform: rotate(360deg);
} }
} }
@media (max-width: 768px) {
::ng-deep .gallery img {
flex: 1 1 calc(50% - 15px);
}
}
@media (max-width: 480px) {
::ng-deep .gallery img {
flex: 1 1 100%;
}
}
@@ -6,7 +6,7 @@
<h1>{{ article.title }}</h1> <h1>{{ article.title }}</h1>
<div class="content-container"> <div class="content-container">
<!-- Article Content --> <!-- Article Content -->
<div class="article-content" [innerHTML]="article.content"></div> <div #articleContent class="article-content" [innerHTML]="article.content"></div>
<a href="/blog"><button>{{ 'ARTICLE_BACK' | translate }}</button></a> <a href="/blog"><button>{{ 'ARTICLE_BACK' | translate }}</button></a>
<!-- Article Metadata --> <!-- Article Metadata -->
@@ -17,6 +17,10 @@
</div> </div>
</div> </div>
</div> </div>
<!-- Modal -->
<div class="modal" *ngIf="selectedImage" (click)="closePreview()">
<img [src]="selectedImage" alt="Full Preview" />
</div>
</div> </div>
<!-- Loading State--> <!-- Loading State-->
<div *ngIf="loading" class="loading-container"> <div *ngIf="loading" class="loading-container">
@@ -1,4 +1,4 @@
import {AfterViewInit, Component, Inject, OnDestroy, OnInit, PLATFORM_ID} from '@angular/core'; import {AfterViewInit, Component, ElementRef, Inject, OnDestroy, OnInit, PLATFORM_ID, ViewChild} from '@angular/core';
import {DeviceDetectorService} from '../../shared/services/device-detector.service' import {DeviceDetectorService} from '../../shared/services/device-detector.service'
import {DatePipe, isPlatformBrowser, NgIf, NgStyle} from '@angular/common'; import {DatePipe, isPlatformBrowser, NgIf, NgStyle} from '@angular/common';
import {VantaBackgroundService} from '../../shared/services/vanta-background.service'; import {VantaBackgroundService} from '../../shared/services/vanta-background.service';
@@ -31,6 +31,9 @@ interface Article {
styleUrl: './article-page.component.css' styleUrl: './article-page.component.css'
}) })
export class ArticlePageComponent implements OnInit, OnDestroy, AfterViewInit { export class ArticlePageComponent implements OnInit, OnDestroy, AfterViewInit {
@ViewChild('articleContent') articleContent!: ElementRef<HTMLDivElement>;
selectedImage: string | null = null;
private imagesProcessed = false;
private readonly elementId = 'vanta-article-bg'; private readonly elementId = 'vanta-article-bg';
isMobile: boolean = false; isMobile: boolean = false;
article: Article | undefined; article: Article | undefined;
@@ -98,6 +101,27 @@ export class ArticlePageComponent implements OnInit, OnDestroy, AfterViewInit {
color: 0xac1f4e, color: 0xac1f4e,
backgroundColor: 0x191522 backgroundColor: 0x191522
}); });
this.makeImagesClickable();
this.imagesProcessed = true;
}
private makeImagesClickable() {
const imgs: NodeListOf<HTMLImageElement> = this.articleContent.nativeElement.querySelectorAll('img');
imgs.forEach(img => {
img.style.cursor = 'pointer';
if (!img.dataset['clickable']) {
img.addEventListener('click', () => this.openPreview(img.src));
img.dataset['clickable'] = 'true';
}
});
}
openPreview(src: string) {
this.selectedImage = src;
}
closePreview() {
this.selectedImage = null;
} }
ngOnDestroy() { ngOnDestroy() {
@@ -114,17 +138,19 @@ export class ArticlePageComponent implements OnInit, OnDestroy, AfterViewInit {
loadTitleBySlug(slug: string) { loadTitleBySlug(slug: string) {
this.articleService.getArticleBySlug(slug).subscribe( this.articleService.getArticleBySlug(slug).subscribe(
(article) => { (article) => {
if (article) { this.article = article;
this.currentArticle = article; this.loading = false;
this.titleService.setTitle( article.title );
} else { setTimeout(() => this.makeImagesClickable(), 0);
console.warn('Article not found for slug:', slug);
this.titleService.setTitle('Article Not Found'); console.log('Article found!')
}
}, },
(error) => { (error) => {
console.error('Failed to load article title', error); console.error('Error fetching article:', error);
this.titleService.setTitle('Error loading Article'); this.loading = false;
if (error.status === 404) {
this.error = true;
}
} }
); );
} }
+55
View File
@@ -74,6 +74,7 @@
width: 100%; width: 100%;
border-radius: 8px; border-radius: 8px;
margin-bottom: 2px; margin-bottom: 2px;
cursor: pointer;
} }
.gallery-item:hover { .gallery-item:hover {
@@ -117,6 +118,60 @@
color: cornflowerblue; color: cornflowerblue;
} }
.modal-backdrop {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.7);
color: white;
display: flex;
justify-content: center;
align-items: center;
z-index: 9999;
}
.modal-content {
background: transparent;
padding: 1rem;
border-radius: 8px;
max-width: 80vw;
max-height: 80vh;
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.modal-content img {
max-width: 100%;
max-height: 80vh;
object-fit: contain;
border-radius: 8px;
}
.modal-content button {
background-color: #FF5C8D;
border: none;
padding: 10px 20px;
border-radius: 25px;
cursor: pointer;
color: white;
font-size: 1.1rem;
font-weight: bold;
font-family: Roboto, serif;
}
.modal-content button:hover {
background-color: #FF3C75;
}
.modal-content button:active {
background-color: #ef85a4;
}
hr.rounded { hr.rounded {
border: 2px solid white; border: 2px solid white;
width: 40px; width: 40px;
+14 -42
View File
@@ -1,6 +1,6 @@
<div id="vanta-portfolio-bg"></div> <div id="vanta-portfolio-bg"></div>
<div class="height-container"> <div class="height-container">
<div class="portfolio-container"> <div class="portfolio-container">
<div class="portfolio-header" [ngStyle]="{'margin-top': isMobile ? '60px' : '120px'}"> <div class="portfolio-header" [ngStyle]="{'margin-top': isMobile ? '60px' : '120px'}">
<h1>{{ 'PORTF_TITLE' | translate }}</h1> <h1>{{ 'PORTF_TITLE' | translate }}</h1>
<p class="subtitle">{{ 'PORTF_SUB' | translate }}</p> <p class="subtitle">{{ 'PORTF_SUB' | translate }}</p>
@@ -14,48 +14,20 @@
<button class="ko-fi-btn">Commission me on Ko-Fi</button> <button class="ko-fi-btn">Commission me on Ko-Fi</button>
</a> </a>
</div> </div>
<div class="portfolio-gallery"> <div class="portfolio-gallery" [@staggerGallery]>
<div class="gallery-item"> <div class="gallery-item" *ngFor="let item of galleryItems" (click)="openModal(item)">
<img src="/assets/design1.png" alt="Design 1"> <img [src]="item.src" [alt]="item.alt">
<p>Abstract Background</p> <p>{{ item.label }}</p>
</div> </div>
<div class="gallery-item"> </div>
<img src="/assets/design2.png" alt="Design 2"> </div>
<p>Profile Picture Design</p> <!-- Modal -->
</div> <div class="modal-backdrop" *ngIf="showModal" (click)="closeModal()">
<div class="gallery-item"> <div class="modal-content" (click)="$event.stopPropagation()">
<img src="/assets/design3.png" alt="Design 3"> <img [src]="selectedItem?.src" [alt]="selectedItem?.alt">
<p>Pixelart Canvas</p> <h2>{{ selectedItem?.label }}</h2>
</div> <button (click)="closeModal()">Close</button>
<div class="gallery-item">
<img src="/assets/design4.png" alt="Design 4">
<p>Profile Picture Design 2</p>
</div>
<div class="gallery-item">
<img src="/assets/design5.png" alt="Design 5">
<p>Social Media Banner</p>
</div>
<div class="gallery-item">
<img src="/assets/design6.png" alt="Design 6">
<p>Logo Design</p>
</div>
<div class="gallery-item">
<img src="/assets/design7.png" alt="Design 6">
<p>Clipart Design</p>
</div>
<div class="gallery-item">
<a href="https://github.com/itzMiney/itzmineydev">
<img src="https://opengraph.githubassets.com/1/itzMiney/itzmineydev" alt="Frontend">
<p>itzMiney.dev Frontend</p>
</a>
</div>
<div class="gallery-item">
<a href="https://github.com/Hideout-Codeworks/DoritoBot">
<img src="https://opengraph.githubassets.com/1/Hideout-Codeworks/DoritoBot" alt="DoritoBot">
<p>DoritoBot</p>
</a>
</div> </div>
</div> </div>
</div>
</div> </div>
<app-audio-player></app-audio-player> <app-audio-player></app-audio-player>
+51 -3
View File
@@ -1,22 +1,60 @@
import {AfterViewInit, Component, Inject, OnDestroy, OnInit, PLATFORM_ID} from '@angular/core'; import {AfterViewInit, Component, Inject, OnDestroy, OnInit, PLATFORM_ID} from '@angular/core';
import {VantaBackgroundService} from '../shared/services/vanta-background.service'; import {VantaBackgroundService} from '../shared/services/vanta-background.service';
import {DeviceDetectorService} from '../shared/services/device-detector.service'; import {DeviceDetectorService} from '../shared/services/device-detector.service';
import {isPlatformBrowser, NgStyle} from '@angular/common'; import {CommonModule, isPlatformBrowser, NgStyle} from '@angular/common';
import {Title} from '@angular/platform-browser'; import {Title} from '@angular/platform-browser';
import {AudioPlayerComponent} from '../shared/audio-player/audio-player.component'; import {AudioPlayerComponent} from '../shared/audio-player/audio-player.component';
import {TranslatePipe} from '@ngx-translate/core'; import {TranslatePipe} from '@ngx-translate/core';
import {animate, stagger, style, transition, trigger, query} from '@angular/animations';
@Component({ @Component({
selector: 'app-portfolio', selector: 'app-portfolio',
imports: [ imports: [
NgStyle, NgStyle,
AudioPlayerComponent, AudioPlayerComponent,
TranslatePipe TranslatePipe,
CommonModule
], ],
templateUrl: './portfolio.component.html', templateUrl: './portfolio.component.html',
styleUrl: './portfolio.component.css' styleUrl: './portfolio.component.css',
animations: [
trigger('fadeInOut', [
transition(':enter', [
style({ opacity: 0, transform: 'translateY(20px)' }),
animate('0.5s ease-out', style({ opacity: 1, transform: 'translateY(0)' }))
]),
transition(':leave', [
animate('0.3s ease-in', style({ opacity: 0, transform: 'translateY(20px)' }))
])
]),
trigger('staggerGallery', [
transition(':enter', [
query('.gallery-item', [
style({ opacity: 0, transform: 'translateY(20px)' }),
stagger(100, [
animate('0.5s ease-out', style({ opacity: 1, transform: 'translateY(0)' }))
])
], {
optional: true
})
])
])
]
}) })
export class PortfolioComponent implements OnInit, OnDestroy, AfterViewInit { export class PortfolioComponent implements OnInit, OnDestroy, AfterViewInit {
galleryItems = [
{ src: '/assets/design1.png', alt: 'Design 1', label: 'Abstract Background' },
{ src: '/assets/design2.png', alt: 'Design 2', label: 'Profile Picture Design' },
{ src: '/assets/design3.png', alt: 'Design 3', label: 'Pixelart Canvas' },
{ src: '/assets/design4.png', alt: 'Design 4', label: 'Profile Picture Design 2' },
{ src: '/assets/design5.png', alt: 'Design 5', label: 'Social Media Banner' },
{ src: '/assets/design6.png', alt: 'Design 6', label: 'Logo Design' },
{ src: '/assets/design7.png', alt: 'Design 7', label: 'Clipart Design' },
{ src: 'https://opengraph.githubassets.com/1/itzMiney/itzmineydev', alt: 'Frontend', label: 'itzMiney.dev Frontend' },
{ src: 'https://opengraph.githubassets.com/1/Hideout-Codeworks/DoritoBot', alt: 'DoritoBot', label: 'DoritoBot' },
];
selectedItem: any = null;
showModal = false;
private readonly elementId = 'vanta-portfolio-bg'; private readonly elementId = 'vanta-portfolio-bg';
isMobile: boolean = false; isMobile: boolean = false;
constructor( constructor(
@@ -51,4 +89,14 @@ export class PortfolioComponent implements OnInit, OnDestroy, AfterViewInit {
// Update the minHeight and minWidth when the window is resized // Update the minHeight and minWidth when the window is resized
this.vantaService.resizeVanta(this.elementId); this.vantaService.resizeVanta(this.elementId);
} }
openModal(item: any) {
this.selectedItem = item;
this.showModal = true;
}
closeModal() {
this.selectedItem = null;
this.showModal = false;
}
} }