File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
src/pages/editprofile/components Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ import { cn } from '@/utils' ;
2+ import { twMerge } from 'tailwind-merge' ;
3+ import { motion } from 'framer-motion' ;
4+ import { useState } from 'react' ;
5+
6+ interface TabMenuProps {
7+ activeTab : 'profile' | 'password' ;
8+ onChange : ( tab : 'profile' | 'password' ) => void ;
9+ }
10+
11+ const TabMenu = ( { activeTab, onChange } : TabMenuProps ) => {
12+ const [ hoverTab , setHoverTab ] = useState < 'profile' | 'password' | null > ( null ) ;
13+ const currentTab = hoverTab || activeTab ;
14+
15+ return (
16+ < div className = "relative flex" >
17+ < button
18+ className = { cn ( 'p-3 flex-1 cursor-pointer' , activeTab === 'profile' && 'font-bold' ) }
19+ onClick = { ( ) => onChange ( 'profile' ) }
20+ onMouseEnter = { ( ) => setHoverTab ( 'profile' ) }
21+ onMouseLeave = { ( ) => setHoverTab ( null ) }
22+ >
23+ 프로필 수정
24+ </ button >
25+ < button
26+ className = { cn ( 'p-3 flex-1 cursor-pointer' , activeTab === 'password' && 'font-bold' ) }
27+ onClick = { ( ) => onChange ( 'password' ) }
28+ onMouseEnter = { ( ) => setHoverTab ( 'password' ) }
29+ onMouseLeave = { ( ) => setHoverTab ( null ) }
30+ >
31+ 비밀번호 변경
32+ </ button >
33+ < motion . div
34+ layout
35+ className = { twMerge (
36+ 'absolute bottom-0 h-[2px] w-1/2 bg-primary-active transition-all duration-300' ,
37+ currentTab === 'profile' ? 'left-0' : 'left-1/2' ,
38+ ) }
39+ />
40+ </ div >
41+ ) ;
42+ } ;
43+
44+ export default TabMenu ;
You can’t perform that action at this time.
0 commit comments