Menu.js 1 KB
Newer Older
Choi Ga Young's avatar
Choi Ga Young committed
1
import React from 'react'
2
import { Navbar, Nav } 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

  return (
우지원's avatar
우지원 committed
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
    <Navbar style={{ backgroundColor: "#61477a" }} variant="dark">
      <div className="container-fluid">
        <Navbar.Brand className="navbar-brand" href="/home">YDK Messenger</Navbar.Brand>
        {name ?
          <>
            <Nav className="nav navbar-nav mr-auto" style={{ color: 'white' }}>
              <Nav.Item className="mt-2 mr-4">{name} 환영합니다</Nav.Item>
              <Nav.Link href="/profile">Profile</Nav.Link>
              <Nav.Link onClick={() => handleLogout()} href="/login">logout</Nav.Link>
            </Nav>
          </>
          : <>
            <Nav className="nav navbar-nav">
              <Nav.Link href="/login">Login</Nav.Link>
              <Nav.Link href="/signup">Signup</Nav.Link>
            </Nav>
          </>}
      </div>
Choi Ga Young's avatar
Choi Ga Young committed
29
30
31
32
    </Navbar>
  )
}

우지원's avatar
우지원 committed
33

Choi Ga Young's avatar
Choi Ga Young committed
34
export default Menu