Menu.js 858 Bytes
Newer Older
Choi Ga Young's avatar
Choi Ga Young committed
1
import React from 'react'
Choi Ga Young's avatar
Choi Ga Young committed
2
import { Navbar, Nav, Button } from 'react-bootstrap';
3
import { handleLogout } from '../utils/auth';
Choi Ga Young's avatar
Choi Ga Young committed
4

5

Choi Ga Young's avatar
Choi Ga Young committed
6
function Menu() {
7

Choi Ga Young's avatar
aa    
Choi Ga Young committed
8
  const name = sessionStorage.getItem('name');
Choi Ga Young's avatar
Choi Ga Young committed
9
10
11
12

  return (
    <Navbar bg="dark" variant="dark">
      <Navbar.Brand href="/home">YDK Messenger</Navbar.Brand>
우지원's avatar
우지원 committed
13
14
      {name ?
        <>
우지원's avatar
수정    
우지원 committed
15
          <div className='ml-1 mr-2' style={{ color: 'white' }}>{name} 환영합니다</div>
우지원's avatar
우지원 committed
16
17
18
          <Nav className="mr-auto">
            <Nav.Link href="/profile">Profile</Nav.Link>
          </Nav>
우지원's avatar
우지원 committed
19
          <Button className="ml-auto" onClick={() => handleLogout()} variant="light">Logout</Button>
우지원's avatar
우지원 committed
20
21
22
23
24
        </>
        : <Nav className="ml-auto">
          <Nav.Link href='/login'>로그인</Nav.Link>
          <Nav.Link href='/signup'>회원가입</Nav.Link>
        </Nav>}
Choi Ga Young's avatar
Choi Ga Young committed
25
26
27
28
29
    </Navbar>
  )
}

export default Menu