File tree Expand file tree Collapse file tree 2 files changed +39
-37
lines changed Expand file tree Collapse file tree 2 files changed +39
-37
lines changed Original file line number Diff line number Diff line change @@ -20,38 +20,36 @@ function Layout() {
2020 location . pathname === '/chat' ;
2121
2222 return (
23- < div className = "flex justify-center w-full min-h-screen" >
24- < div className = "max-w-[600px] min-w-[320px] w-full bg-background flex flex-col" >
25- { /* 헤더 */ }
26- < HeaderWrapper />
23+ < div className = "max-w-[600px] min-w-[320px] w-full bg-background flex min-h-screen mx-auto" >
24+ { /* 헤더 */ }
25+ < HeaderWrapper />
2726
28- { /* 메인 컨텐츠 영역 */ }
29- < div
30- className = { twMerge (
31- 'pt-[44px] flex-1 flex justify-center w-full px-3' ,
32- showNav && 'pb-[62px] ' , // 하단 네비게이션 숨길때만 padding주기
33- ) }
34- >
35- < MyErrorBoundary >
36- < AnimatePresence mode = "wait" >
37- < motion . div
38- key = { location . pathname } // 경로가 바뀔 때마다 애니메이션 트리거
39- initial = { { opacity : 0 } }
40- animate = { { opacity : 1 } }
41- transition = { { duration : 0.3 } }
42- className = "flex justify-center w-full h-full"
43- >
44- < Outlet />
45- </ motion . div >
46- </ AnimatePresence >
47- </ MyErrorBoundary >
48- </ div >
49-
50- { /* 하단 네비게이션 */ }
51- < BottomNavWrapper />
52- { /* 글작성 버튼 */ }
53- < PostButton />
27+ { /* 메인 컨텐츠 영역 */ }
28+ < div
29+ className = { twMerge (
30+ 'pt-[44px] flex-1 flex justify-center w-full px-3' ,
31+ showNav && 'pb-[62px] ' , // 하단 네비게이션 숨길때만 padding주기
32+ ) }
33+ >
34+ < MyErrorBoundary >
35+ < AnimatePresence mode = "wait" >
36+ < motion . div
37+ key = { location . pathname } // 경로가 바뀔 때마다 애니메이션 트리거
38+ initial = { { opacity : 0 } }
39+ animate = { { opacity : 1 } }
40+ transition = { { duration : 0.3 } }
41+ className = "flex justify-center w-full h-full"
42+ >
43+ < Outlet />
44+ </ motion . div >
45+ </ AnimatePresence >
46+ </ MyErrorBoundary >
5447 </ div >
48+
49+ { /* 하단 네비게이션 */ }
50+ < BottomNavWrapper />
51+ { /* 글작성 버튼 */ }
52+ < PostButton />
5553 </ div >
5654 ) ;
5755}
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { useState } from 'react';
22import ProfileEditForm from '@/pages/editprofile/components/ProfileEditForm' ;
33import PasswordEditForm from '@/pages/editprofile/components/PasswordEditForm' ;
44import { twMerge } from 'tailwind-merge' ;
5+ import { AnimatePresence , motion } from 'framer-motion' ;
56
67function EditProfile ( ) {
78 const [ activeTab , setActiveTab ] = useState ( 'profile' ) ;
@@ -31,13 +32,16 @@ function EditProfile() {
3132 </ div >
3233
3334 { /* 폼 */ }
34- { activeTab === 'profile' ? (
35- // 프로필 수정 탭
36- < ProfileEditForm />
37- ) : (
38- // 비밀번호 변경 탭
39- < PasswordEditForm />
40- ) }
35+ < AnimatePresence mode = "wait" >
36+ < motion . div
37+ key = { activeTab } // 핵심! key를 다르게 주면 된다
38+ initial = { { opacity : 0 } }
39+ animate = { { opacity : 1 } }
40+ transition = { { duration : 0.3 } }
41+ >
42+ { activeTab === 'profile' ? < ProfileEditForm /> : < PasswordEditForm /> }
43+ </ motion . div >
44+ </ AnimatePresence >
4145 </ div >
4246 ) ;
4347}
You can’t perform that action at this time.
0 commit comments