Menu.js 1.57 KB
Newer Older
Soo Hyun Kim's avatar
Soo Hyun Kim committed
1
2
import React from 'react'
import { Nav } from 'react-bootstrap';
3
import { handleLogout } from '../utils/auth';
Soo Hyun Kim's avatar
Soo Hyun Kim committed
4
import { BsPeopleCircle } from "react-icons/bs";
Soo Hyun Kim's avatar
Soo Hyun Kim committed
5
import { AiOutlineLogout } from "react-icons/ai";
Soo Hyun Kim's avatar
Soo Hyun Kim committed
6
import "../menu.css";
7

Soo Hyun Kim's avatar
Soo Hyun Kim committed
8
function Menu(props) {
9

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

  return (
Soo Hyun Kim's avatar
Soo Hyun Kim committed
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
    <div className="container-fluid" style={{ display: "flex", flexDirection: "row", backgroundColor: "#61477a", heigth: "100%", position: "relative" }}>
      <p className="navbar-brand" href="/home" style={{color: 'white', alignItems: "center"}}>YDK Messenger</p>
      {name ?
        <>
          <div className="nav navbar-nav mr-auto" style={{ color: 'white', display: "flex", flexDirection: "row", alignItems: "center"}}>
            <p className="mt-2 mr-4">{name} 환영합니다</p>
            <div className="showText">
              <a href="/profile" style={{color:"#FFFFFF", marginRight: "15px"}}>{'Profile'}</a>
              <a onClick={() => handleLogout()} href="/login" style={{color:"#FFFFFF"}}>{'logout'}</a>
            </div>
            <div className="showIcon">
              <a href="/profile" style={{marginRight: "15px"}}><BsPeopleCircle size="25" color="#FFFFFF" /></a>
              <a href="/login" onClick={() => handleLogout()}><AiOutlineLogout size="25" color="#FFFFFF" /></a>
            </div>
          </div>
        </>
        : <>
          <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
36
37
38
39
  )
}

export default Menu