feat(gallery): ajout d'un modal de galerie et de nouvelles images

- Création du composant GalleryModal pour afficher les images en plein écran avec navigation.
- Ajout de styles CSS pour le modal de galerie.
- Intégration de la logique de gestion de la galerie dans le composable useGallery.
- Ajout de nouvelles images WebP pour le projet FlowBoard.
- Mise à jour des pages Home et ProjectDetail pour utiliser le nouveau composant de galerie.
This commit is contained in:
Mr¤KayJayDee
2025-06-23 00:20:16 +02:00
parent da79d5e2da
commit 06172aae62
15 changed files with 681 additions and 157 deletions

View File

@@ -0,0 +1,99 @@
<script setup lang="ts">
import { onMounted, onUnmounted } from 'vue'
import { useAssets } from '@/composables/useAssets'
import './styles/GalleryModal.css'
interface Props {
isOpen: boolean
currentImage: string
currentIndex: number
totalImages: number
hasNext: boolean
hasPrevious: boolean
projectTitle: string
}
const props = defineProps<Props>()
const emit = defineEmits<{
close: []
next: []
previous: []
goTo: [index: number]
}>()
const { getImageUrl } = useAssets()
// Keyboard navigation
const handleKeydown = (event: KeyboardEvent) => {
if (!props.isOpen) return
switch (event.key) {
case 'Escape':
emit('close')
break
case 'ArrowLeft':
if (props.hasPrevious) emit('previous')
break
case 'ArrowRight':
if (props.hasNext) emit('next')
break
}
}
onMounted(() => {
document.addEventListener('keydown', handleKeydown)
})
onUnmounted(() => {
document.removeEventListener('keydown', handleKeydown)
})
</script>
<template>
<Teleport to="body">
<div v-if="isOpen" class="gallery-modal" @click="emit('close')">
<div class="gallery-modal-overlay"></div>
<!-- Close Button -->
<button class="gallery-close" @click="emit('close')">
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
</svg>
</button>
<!-- Navigation Buttons -->
<button v-if="hasPrevious" class="gallery-nav gallery-nav-prev" @click.stop="emit('previous')">
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"></path>
</svg>
</button>
<button v-if="hasNext" class="gallery-nav gallery-nav-next" @click.stop="emit('next')">
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path>
</svg>
</button>
<!-- Main Image -->
<div class="gallery-content" @click.stop>
<img :src="getImageUrl(currentImage)" :alt="`${projectTitle} - Image ${currentIndex + 1}`"
class="gallery-image">
<!-- Image Info -->
<div class="gallery-info">
<h3 class="gallery-title">{{ projectTitle }}</h3>
<p class="gallery-counter">{{ currentIndex + 1 }} / {{ totalImages }}</p>
</div>
<!-- Thumbnails -->
<div v-if="totalImages > 1" class="gallery-thumbnails">
<button v-for="(_, index) in totalImages" :key="index" class="gallery-thumbnail"
:class="{ active: index === currentIndex }" @click="emit('goTo', index)">
<div class="thumbnail-indicator"></div>
</button>
</div>
</div>
</div>
</Teleport>
</template>

View File

@@ -0,0 +1,201 @@
/* GalleryModal Styles */
.gallery-modal {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 9999;
display: flex;
align-items: center;
justify-content: center;
padding: 1rem;
}
.gallery-modal-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.9);
backdrop-filter: blur(4px);
}
.gallery-close {
position: absolute;
top: 1rem;
right: 1rem;
z-index: 10001;
width: 3rem;
height: 3rem;
border: none;
border-radius: 50%;
background: rgba(255, 255, 255, 0.1);
color: white;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
backdrop-filter: blur(10px);
}
.gallery-close:hover {
background: rgba(255, 255, 255, 0.2);
transform: scale(1.1);
}
.gallery-close svg {
width: 1.5rem;
height: 1.5rem;
}
.gallery-nav {
position: absolute;
top: 50%;
transform: translateY(-50%);
z-index: 10001;
width: 3rem;
height: 3rem;
border: none;
border-radius: 50%;
background: rgba(255, 255, 255, 0.1);
color: white;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
backdrop-filter: blur(10px);
}
.gallery-nav:hover {
background: rgba(255, 255, 255, 0.2);
transform: translateY(-50%) scale(1.1);
}
.gallery-nav-prev {
left: 1rem;
}
.gallery-nav-next {
right: 1rem;
}
.gallery-nav svg {
width: 1.5rem;
height: 1.5rem;
}
.gallery-content {
position: relative;
z-index: 10000;
max-width: 90vw;
max-height: 90vh;
display: flex;
flex-direction: column;
align-items: center;
}
.gallery-image {
max-width: 100%;
max-height: 80vh;
object-fit: contain;
border-radius: 0.5rem;
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
.gallery-info {
margin-top: 1rem;
text-align: center;
color: white;
}
.gallery-title {
font-size: 1.25rem;
font-weight: 600;
margin: 0 0 0.5rem 0;
}
.gallery-counter {
font-size: 0.875rem;
opacity: 0.8;
margin: 0;
}
.gallery-thumbnails {
display: flex;
gap: 0.5rem;
margin-top: 1rem;
justify-content: center;
flex-wrap: wrap;
}
.gallery-thumbnail {
width: 0.75rem;
height: 0.75rem;
border: none;
border-radius: 50%;
background: none;
cursor: pointer;
padding: 0;
}
.thumbnail-indicator {
width: 100%;
height: 100%;
border-radius: 50%;
background: rgba(255, 255, 255, 0.4);
transition: all 0.2s ease;
}
.gallery-thumbnail.active .thumbnail-indicator {
background: white;
transform: scale(1.2);
}
.gallery-thumbnail:hover .thumbnail-indicator {
background: rgba(255, 255, 255, 0.7);
transform: scale(1.1);
}
/* Mobile adjustments */
@media (max-width: 768px) {
.gallery-modal {
padding: 0.5rem;
}
.gallery-close,
.gallery-nav {
width: 2.5rem;
height: 2.5rem;
}
.gallery-close svg,
.gallery-nav svg {
width: 1.25rem;
height: 1.25rem;
}
.gallery-nav-prev {
left: 0.5rem;
}
.gallery-nav-next {
right: 0.5rem;
}
.gallery-image {
max-height: 70vh;
}
.gallery-title {
font-size: 1rem;
}
.gallery-counter {
font-size: 0.75rem;
}
}