File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed 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