File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11---
22import { Image } from ' astro:assets'
33import { Icon } from ' @/custom/components/user'
4- import { LightGallery } from ' astro-lightgallery '
4+ // Removed LightGallery import
55
66import GalleryLayout from ' @/layouts/GalleryLayout.astro'
77import Banner from ' @/components/banner/Banner.astro'
@@ -94,15 +94,7 @@ const allCats = Object.entries(info)
9494 <!-- Section 2: Photo Gallery -->
9595 <section class =' photo-gallery' >
9696 <h2 class =' section-title' >📸 生活瞬间</h2 >
97- <LightGallery
98- class =' masonry-grid'
99- options ={ {
100- thumbnail: true ,
101- autoplay: true ,
102- slideShowInterval: 500
103- }}
104- addPlugins ={ [' zoom' ]}
105- >
97+ <div class =' masonry-grid' >
10698 {
10799 photos .map ((photo ) => {
108100 const subjects = photo .subjects ?.join (' ' ) || ' unknown'
@@ -124,7 +116,7 @@ const allCats = Object.entries(info)
124116 )
125117 })
126118 }
127- </LightGallery >
119+ </div >
128120 </section >
129121</GalleryLayout >
130122
@@ -376,21 +368,37 @@ const allCats = Object.entries(info)
376368 padding: 2rem 1rem;
377369 }
378370 .masonry-grid {
379- display: flex;
380- flex-wrap: wrap;
381- justify-content: center;
382- gap: 1rem;
371+ column-count: 1;
372+ column-gap: 1rem;
373+ }
374+ @media (min-width: 640px) {
375+ .masonry-grid {
376+ column-count: 2;
377+ }
378+ }
379+ @media (min-width: 1024px) {
380+ .masonry-grid {
381+ column-count: 3;
382+ }
383383 }
384+ @media (min-width: 1280px) {
385+ .masonry-grid {
386+ column-count: 4;
387+ }
388+ }
389+
384390 .masonry-item {
385391 position: relative;
386392 overflow: hidden;
387393 border-radius: 8px;
388- display: block; /* For filtering */
389- height: 300px;
394+ display: inline-block; /* Important for column layout to prevent splitting */
395+ width: 100%;
396+ margin-bottom: 1rem;
397+ break-inside: avoid;
390398 }
391399 .masonry-item img {
392- height : 100%;
393- width : auto;
400+ width : 100%;
401+ height : auto;
394402 display: block;
395403 transition: transform 0.3s ease;
396404 }
You can’t perform that action at this time.
0 commit comments