File tree Expand file tree Collapse file tree 3 files changed +74
-1
lines changed Expand file tree Collapse file tree 3 files changed +74
-1
lines changed Original file line number Diff line number Diff line change 11import * as styles from './home-page.css' ;
2+ import Header from '../../shared/components/header/header' ;
23
34const HomePage = ( ) => {
4- return < div className = { styles . title } > 홈 페이지</ div > ;
5+ return (
6+ < >
7+ < Header />
8+ < div className = { styles . title } > 홈 페이지</ div >
9+ </ >
10+ ) ;
511} ;
612
713export default HomePage ;
Original file line number Diff line number Diff line change 1+ import { vars } from '../../../styles/theme.css' ;
2+ import { style } from '@vanilla-extract/css' ;
3+
4+ export const headerContainer = style ( {
5+ width : '100%' ,
6+ height : '6.4rem' ,
7+ position : 'fixed' ,
8+ top : 0 ,
9+ left : 0 ,
10+ background : 'white' ,
11+ borderBottom : `1px solid ${ vars . color . gray300 } ` ,
12+ display : 'flex' ,
13+ alignItems : 'center' ,
14+ justifyContent : 'space-between' ,
15+ zIndex : 10 ,
16+ padding : '0 10rem' ,
17+ } ) ;
18+
19+ export const logo = style ( {
20+ fontSize : '2.4rem' ,
21+ fontWeight : 'bold' ,
22+ color : vars . color . gray800 ,
23+ cursor : 'pointer' ,
24+ userSelect : 'none' ,
25+ } ) ;
26+
27+ export const logout = style ( {
28+ width : 'auto' ,
29+ padding : '0' ,
30+ border : 'none' ,
31+ backgroundColor : 'transparent' ,
32+ color : vars . color . gray800 ,
33+ fontSize : vars . size . xs ,
34+ fontWeight : vars . weight . regular ,
35+ cursor : 'pointer' ,
36+ userSelect : 'none' ,
37+ } ) ;
Original file line number Diff line number Diff line change 1+ import * as styles from './header.css' ;
2+ import { useNavigate } from 'react-router-dom' ;
3+ import { logout } from '../../api/auth' ;
4+
5+ const Header = ( ) => {
6+ const navigate = useNavigate ( ) ;
7+
8+ const handleLogout = async ( ) => {
9+ try {
10+ await logout ( ) ;
11+ localStorage . removeItem ( 'accessToken' ) ;
12+ navigate ( '/login' , { replace : true } ) ;
13+ } catch ( e ) {
14+ console . error ( 'Logout failed:' , e ) ;
15+ }
16+ } ;
17+
18+ return (
19+ < div className = { styles . headerContainer } >
20+ < div className = { styles . logo } onClick = { ( ) => navigate ( '/' ) } >
21+ FINI
22+ </ div >
23+ < button className = { styles . logout } onClick = { handleLogout } >
24+ 로그아웃
25+ </ button >
26+ </ div >
27+ ) ;
28+ } ;
29+
30+ export default Header ;
You can’t perform that action at this time.
0 commit comments