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

function Menu() {
  const userName = "정연우";
우지원's avatar
우지원 committed
7
  const user = isAuthenticated()
Choi Ga Young's avatar
Choi Ga Young committed
8
9
10
11

  return (
    <Navbar bg="dark" variant="dark">
      <Navbar.Brand href="/home">YDK Messenger</Navbar.Brand>
우지원's avatar
우지원 committed
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

      {user ?
        <>
          <div className='ml-1 mr-2' style={{ color: 'white' }}>{userName}  환영합니다</div>
          <Nav className="mr-auto">
            <Nav.Link href="/home">Home</Nav.Link>
            <Nav.Link href="/profile">Profile</Nav.Link>
            <Nav.Link href="/hello">Hello</Nav.Link>
          </Nav>
          <Button className="ml-auto" onClick={() => handleLogout()} variant="light" className="ml-3">Logout</Button>
        </>
        : <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
28
29
30
31
32
    </Navbar>
  )
}

export default Menu