Skip to content

Commit 8f4df40

Browse files
committed
feat(projects): add image gallery modals to projects pages
- Import and render ImageGalleryModal at page level - Pass project id to ProjectCard component - Support full-screen image viewing on both EN and VI pages - Projects ordered by order field from JSON config
1 parent 3964d6e commit 8f4df40

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

src/pages/projects.astro

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { getCollection } from 'astro:content';
33
import BaseLayout from '@layouts/BaseLayout.astro';
44
import ProjectCard from '@components/ProjectCard.astro';
5+
import ImageGalleryModal from '@components/ImageGalleryModal.astro';
56
import { getLangFromUrl, useTranslations } from '@i18n/utils';
67
78
const lang = getLangFromUrl(Astro.url);
@@ -63,7 +64,7 @@ const getCategoryName = (category: string) => {
6364
class="project-item"
6465
data-category={project.data.category.toLowerCase()}
6566
>
66-
<ProjectCard {...project.data} />
67+
<ProjectCard {...project.data} id={project.data.id} />
6768
</div>
6869
))}
6970
</div>
@@ -91,6 +92,9 @@ const getCategoryName = (category: string) => {
9192
</button>
9293
</div>
9394
</div>
95+
96+
<!-- Image Gallery Modals (rendered at page level) -->
97+
<ImageGalleryModal projects={sortedProjects.map(p => ({ id: p.data.id, title: p.data.title, images: p.data.images }))} />
9498
</BaseLayout>
9599

96100
<style>

src/pages/vi/projects.astro

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { getCollection } from 'astro:content';
33
import BaseLayout from '@layouts/BaseLayout.astro';
44
import ProjectCard from '@components/ProjectCard.astro';
5+
import ImageGalleryModal from '@components/ImageGalleryModal.astro';
56
import { getLangFromUrl, useTranslations } from '@i18n/utils';
67
78
const lang = getLangFromUrl(Astro.url);
@@ -63,7 +64,7 @@ const getCategoryName = (category: string) => {
6364
class="project-item"
6465
data-category={project.data.category.toLowerCase()}
6566
>
66-
<ProjectCard {...project.data} />
67+
<ProjectCard {...project.data} id={project.data.id} />
6768
</div>
6869
))}
6970
</div>
@@ -91,6 +92,9 @@ const getCategoryName = (category: string) => {
9192
</button>
9293
</div>
9394
</div>
95+
96+
<!-- Image Gallery Modals (rendered at page level) -->
97+
<ImageGalleryModal projects={sortedProjects.map(p => ({ id: p.data.id, title: p.data.title, images: p.data.images }))} />
9498
</BaseLayout>
9599

96100
<style>

0 commit comments

Comments
 (0)