diff --git a/docs/migration.md b/docs/migration.md index c6ca1ac..4f43464 100644 --- a/docs/migration.md +++ b/docs/migration.md @@ -260,7 +260,8 @@ function App() { - [x] Loading.jsx - [x] ErrorBoundary.jsx - [x] Toast.jsx -- [x] Lightbox.jsx +- [x] Lightbox.jsx (PC용) +- [x] MobileLightbox.jsx (Mobile용, Swiper 기반) - [x] LightboxIndicator.jsx - [x] Tooltip.jsx - [x] ScrollToTop.jsx diff --git a/frontend-temp/src/App.jsx b/frontend-temp/src/App.jsx index 2ddc65c..3cd11d0 100644 --- a/frontend-temp/src/App.jsx +++ b/frontend-temp/src/App.jsx @@ -126,7 +126,7 @@ function App() { + } @@ -142,7 +142,7 @@ function App() { + } diff --git a/frontend-temp/src/components/common/Lightbox.jsx b/frontend-temp/src/components/common/Lightbox.jsx index 101be1c..9d794a8 100644 --- a/frontend-temp/src/components/common/Lightbox.jsx +++ b/frontend-temp/src/components/common/Lightbox.jsx @@ -172,7 +172,10 @@ function Lightbox({ diff --git a/frontend-temp/src/components/common/MobileLightbox.jsx b/frontend-temp/src/components/common/MobileLightbox.jsx index eabec8a..e9c6d73 100644 --- a/frontend-temp/src/components/common/MobileLightbox.jsx +++ b/frontend-temp/src/components/common/MobileLightbox.jsx @@ -55,7 +55,7 @@ function MobileLightbox({ // 이미지 다운로드 const downloadImage = useCallback(async () => { - const imageUrl = images[currentIndex]; + const imageUrl = images?.[currentIndex]; if (!imageUrl) return; try { @@ -109,154 +109,158 @@ function MobileLightbox({ } }, [isOpen]); - if (!isOpen || !images?.length) return null; + // 이미지가 없으면 렌더링하지 않음 + if (!images?.length) return null; return ( - - {/* 상단 헤더 */} -
-
- -
- {showCounter && images.length > 1 && ( - - {currentIndex + 1} / {images.length} - - )} -
- {hasPhotoInfo && ( - - )} - {showDownload && ( - - )} -
-
- - {/* Swiper */} - { - swiperRef.current = swiper; - }} - onSlideChange={(swiper) => onIndexChange(swiper.activeIndex)} - className="w-full h-full" - spaceBetween={0} - slidesPerView={1} - resistance={true} - resistanceRatio={0.5} + {isOpen && ( + - {images.map((url, index) => ( - -
- {teasers?.[index]?.media_type === 'video' ? ( -
-
- ))} -
+ {/* 상단 헤더 */} +
+
+ +
+ {showCounter && images.length > 1 && ( + + {currentIndex + 1} / {images.length} + + )} +
+ {hasPhotoInfo && ( + + )} + {showDownload && ( + + )} +
+
- {/* 인디케이터 */} - {images.length > 1 && ( - swiperRef.current?.slideTo(i)} - width={120} - /> - )} - - {/* 사진 정보 바텀시트 */} - - {showInfo && hasPhotoInfo && ( - window.history.back()} - > - { - if (info.offset.y > 100 || info.velocity.y > 300) { - window.history.back(); - } - }} - className="absolute bottom-0 left-0 right-0 bg-zinc-900 rounded-t-3xl" - onClick={(e) => e.stopPropagation()} - > - {/* 드래그 핸들 */} -
-
-
- - {/* 정보 내용 */} -
-

사진 정보

- - {hasMembers && ( -
-
- -
-
-

멤버

-

{members}

-
-
- )} - - {hasValidConcept && ( -
-
- -
-
-

컨셉

-

{concept}

-
-
+ {/* Swiper */} + { + swiperRef.current = swiper; + }} + onSlideChange={(swiper) => onIndexChange(swiper.activeIndex)} + className="w-full h-full" + spaceBetween={0} + slidesPerView={1} + resistance={true} + resistanceRatio={0.5} + > + {images.map((url, index) => ( + +
+ {teasers?.[index]?.media_type === 'video' ? ( +
- - +
+ ))} +
+ + {/* 인디케이터 */} + {images.length > 1 && ( + swiperRef.current?.slideTo(i)} + width={120} + /> )} - - + + {/* 사진 정보 바텀시트 */} + + {showInfo && hasPhotoInfo && ( + window.history.back()} + > + { + if (info.offset.y > 100 || info.velocity.y > 300) { + window.history.back(); + } + }} + className="absolute bottom-0 left-0 right-0 bg-zinc-900 rounded-t-3xl" + onClick={(e) => e.stopPropagation()} + > + {/* 드래그 핸들 */} +
+
+
+ + {/* 정보 내용 */} +
+

사진 정보

+ + {hasMembers && ( +
+
+ +
+
+

멤버

+

{members}

+
+
+ )} + + {hasValidConcept && ( +
+
+ +
+
+

컨셉

+

{concept}

+
+
+ )} +
+ + + )} + + + )} ); }