fix(lightbox): X 버튼 이벤트 버블링 및 닫기 애니메이션 수정

- PC Lightbox X 버튼에 e.stopPropagation() 추가 (이중 닫힘 방지)
- MobileLightbox AnimatePresence 구조 수정 (exit 애니메이션 활성화)
- 모바일 앨범 상세/갤러리 페이지에 헤더 표시 (hideHeader → pageTitle)
- 문서에 MobileLightbox 컴포넌트 추가

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
caadiq 2026-01-22 14:21:56 +09:00
parent 791a3d699a
commit 21639171e1
4 changed files with 153 additions and 145 deletions

View file

@ -260,7 +260,8 @@ function App() {
- [x] Loading.jsx - [x] Loading.jsx
- [x] ErrorBoundary.jsx - [x] ErrorBoundary.jsx
- [x] Toast.jsx - [x] Toast.jsx
- [x] Lightbox.jsx - [x] Lightbox.jsx (PC용)
- [x] MobileLightbox.jsx (Mobile용, Swiper 기반)
- [x] LightboxIndicator.jsx - [x] LightboxIndicator.jsx
- [x] Tooltip.jsx - [x] Tooltip.jsx
- [x] ScrollToTop.jsx - [x] ScrollToTop.jsx

View file

@ -126,7 +126,7 @@ function App() {
<Route <Route
path="/album/:name" path="/album/:name"
element={ element={
<MobileLayout hideHeader> <MobileLayout pageTitle="앨범">
<MobileAlbumDetail /> <MobileAlbumDetail />
</MobileLayout> </MobileLayout>
} }
@ -142,7 +142,7 @@ function App() {
<Route <Route
path="/album/:name/gallery" path="/album/:name/gallery"
element={ element={
<MobileLayout hideHeader> <MobileLayout pageTitle="앨범">
<MobileAlbumGallery /> <MobileAlbumGallery />
</MobileLayout> </MobileLayout>
} }

View file

@ -172,7 +172,10 @@ function Lightbox({
<button <button
aria-label="닫기" aria-label="닫기"
className="text-white/70 hover:text-white transition-colors" className="text-white/70 hover:text-white transition-colors"
onClick={onClose} onClick={(e) => {
e.stopPropagation();
onClose();
}}
> >
<X size={32} aria-hidden="true" /> <X size={32} aria-hidden="true" />
</button> </button>

View file

@ -55,7 +55,7 @@ function MobileLightbox({
// //
const downloadImage = useCallback(async () => { const downloadImage = useCallback(async () => {
const imageUrl = images[currentIndex]; const imageUrl = images?.[currentIndex];
if (!imageUrl) return; if (!imageUrl) return;
try { try {
@ -109,14 +109,17 @@ function MobileLightbox({
} }
}, [isOpen]); }, [isOpen]);
if (!isOpen || !images?.length) return null; //
if (!images?.length) return null;
return ( return (
<AnimatePresence> <AnimatePresence>
{isOpen && (
<motion.div <motion.div
initial={{ opacity: 0 }} initial={{ opacity: 0 }}
animate={{ opacity: 1 }} animate={{ opacity: 1 }}
exit={{ opacity: 0 }} exit={{ opacity: 0 }}
transition={{ duration: 0.2 }}
className="fixed inset-0 bg-black z-[60] flex flex-col" className="fixed inset-0 bg-black z-[60] flex flex-col"
> >
{/* 상단 헤더 */} {/* 상단 헤더 */}
@ -257,6 +260,7 @@ function MobileLightbox({
)} )}
</AnimatePresence> </AnimatePresence>
</motion.div> </motion.div>
)}
</AnimatePresence> </AnimatePresence>
); );
} }