From 79fb58e2eeeda9f6e72181d5549c18581518a296 Mon Sep 17 00:00:00 2001 From: caadiq Date: Fri, 2 Jan 2026 11:07:51 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=9D=BC=EC=9D=B4=ED=8A=B8=EB=B0=95?= =?UTF-8?q?=EC=8A=A4=20UI=20=EA=B0=9C=EC=84=A0=20-=20min-width/height=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9,=20body=20=EC=8A=A4=ED=81=AC=EB=A1=A4=20?= =?UTF-8?q?=EC=88=A8=EA=B9=80,=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20=ED=81=AC?= =?UTF-8?q?=EA=B8=B0=20=EC=A6=9D=EA=B0=80,=20=EB=A9=A4=EB=B2=84=20?= =?UTF-8?q?=ED=83=9C=EA=B7=B8=20=EA=B0=9C=EB=B3=84=20=ED=91=9C=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/pc/AlbumDetail.jsx | 177 ++++++++++++++----------- frontend/src/pages/pc/AlbumGallery.jsx | 174 ++++++++++++++---------- 2 files changed, 205 insertions(+), 146 deletions(-) diff --git a/frontend/src/pages/pc/AlbumDetail.jsx b/frontend/src/pages/pc/AlbumDetail.jsx index 39fd0e9..96c68df 100644 --- a/frontend/src/pages/pc/AlbumDetail.jsx +++ b/frontend/src/pages/pc/AlbumDetail.jsx @@ -37,6 +37,21 @@ function AlbumDetail() { setLightbox(prev => ({ ...prev, open: false })); }, []); + // 라이트박스 열릴 때 body 스크롤 숨기기 + useEffect(() => { + if (lightbox.open) { + document.documentElement.style.overflow = 'hidden'; + document.body.style.overflow = 'hidden'; + } else { + document.documentElement.style.overflow = ''; + document.body.style.overflow = ''; + } + return () => { + document.documentElement.style.overflow = ''; + document.body.style.overflow = ''; + }; + }, [lightbox.open]); + // 이미지 다운로드 함수 const downloadImage = useCallback(async () => { const imageUrl = lightbox.images[lightbox.index]; @@ -373,90 +388,96 @@ function AlbumDetail() { animate={{ opacity: 1 }} exit={{ opacity: 0 }} transition={{ duration: 0.2 }} - className="fixed inset-0 bg-black/90 z-50 flex items-center justify-center" + className="fixed inset-0 bg-black/95 z-50 overflow-auto" > - {/* 상단 버튼들 */} -
- {/* 다운로드 버튼 */} - - {/* 닫기 버튼 */} - -
- - {/* 이전 버튼 */} - {lightbox.images.length > 1 && ( - - )} - - {/* 로딩 스피너 */} - {!imageLoaded && ( -
-
-
- )} - - {/* 이미지 */} - e.stopPropagation()} - onLoad={() => setImageLoaded(true)} - initial={{ x: slideDirection * 100 }} - animate={{ x: 0 }} - transition={{ duration: 0.25, ease: 'easeOut' }} - /> - - {/* 다음 버튼 */} - {lightbox.images.length > 1 && ( - - )} - - {/* 인디케이터 - 이미지 2개 이상일 때만 표시 */} - {lightbox.images.length > 1 && ( -
- {lightbox.images.map((_, i) => ( - + {/* 닫기 버튼 */} + +
+ + {/* 이전 버튼 */} + {lightbox.images.length > 1 && ( + + )} + + {/* 로딩 스피너 */} + {!imageLoaded && ( +
+
+
+ )} + + {/* 이미지 */} +
+ e.stopPropagation()} + onLoad={() => setImageLoaded(true)} + initial={{ x: slideDirection * 100 }} + animate={{ x: 0 }} + transition={{ duration: 0.25, ease: 'easeOut' }} /> - ))} +
+ + {/* 다음 버튼 */} + {lightbox.images.length > 1 && ( + + )} + + {/* 인디케이터 */} + {lightbox.images.length > 1 && ( +
+ {lightbox.images.map((_, i) => ( +
+ )} - )} )} diff --git a/frontend/src/pages/pc/AlbumGallery.jsx b/frontend/src/pages/pc/AlbumGallery.jsx index 75bff93..4ab29c0 100644 --- a/frontend/src/pages/pc/AlbumGallery.jsx +++ b/frontend/src/pages/pc/AlbumGallery.jsx @@ -76,6 +76,21 @@ function AlbumGallery() { setLightbox(prev => ({ ...prev, open: false })); }, []); + // 라이트박스 열릴 때 body 스크롤 숨기기 + useEffect(() => { + if (lightbox.open) { + document.documentElement.style.overflow = 'hidden'; + document.body.style.overflow = 'hidden'; + } else { + document.documentElement.style.overflow = ''; + document.body.style.overflow = ''; + } + return () => { + document.documentElement.style.overflow = ''; + document.body.style.overflow = ''; + }; + }, [lightbox.open]); + // 이전/다음 이미지 const goToPrev = useCallback(() => { if (photos.length <= 1) return; @@ -225,80 +240,103 @@ function AlbumGallery() { animate={{ opacity: 1 }} exit={{ opacity: 0 }} transition={{ duration: 0.2 }} - className="fixed inset-0 bg-black/95 z-50 flex items-center justify-center" + className="fixed inset-0 bg-black/95 z-50 overflow-auto" > - {/* 상단 버튼들 */} -
- - -
- - {/* 카운터 */} -
- {lightbox.index + 1} / {photos.length} -
- - {/* 이전 버튼 */} - {photos.length > 1 && ( - - )} - - {/* 로딩 스피너 */} - {!imageLoaded && ( -
-
+ {/* 내부 컨테이너 - min-width, min-height 적용 (화면 줄여도 크기 유지, 스크롤) */} +
+ {/* 상단 버튼들 */} +
+ +
- )} - {/* 이미지 */} - setImageLoaded(true)} - initial={{ x: slideDirection * 100 }} - animate={{ x: 0 }} - transition={{ duration: 0.25, ease: 'easeOut' }} - /> + {/* 카운터 */} +
+ {lightbox.index + 1} / {photos.length} +
- {/* 다음 버튼 */} - {photos.length > 1 && ( - - )} + {/* 이전 버튼 - margin으로 이미지와 간격 */} + {photos.length > 1 && ( + + )} - {/* 하단 점 인디케이터 */} -
- {photos.map((_, i) => ( - + )} + + {/* 하단 점 인디케이터 - 한 줄 고정, 스크롤바 숨김 */} +
+ {photos.map((_, i) => ( +
)}