MainNav.js 1.31 KB
Newer Older
1
import React from 'react';
Kim, Subin's avatar
Kim, Subin committed
2
import { Navbar, Nav } from 'react-bootstrap';
3
import logo from '../footprint.svg';
Kim, Subin's avatar
Kim, Subin committed
4
5
import cart from '../cart.svg';
import option from '../option.svg';
이재연's avatar
이재연 committed
6
import { handleLogout, isAuthenticated } from '../utils/auth'
Kim, Subin's avatar
Kim, Subin committed
7
8

function MainNav() {
이재연's avatar
이재연 committed
9
    const user = isAuthenticated()
Kim, Subin's avatar
Kim, Subin committed
10
11

    return (
Kim, Subin's avatar
Kim, Subin committed
12
13
        <Navbar sticky="top" style={{ background: "#CDC5C2" }}>
            <Navbar.Brand href="/home" className="text-light">
Jiwon Yoon's avatar
22    
Jiwon Yoon committed
14
                <img alt="로고" src={logo} width="24" height="24" />
Kim, Subin's avatar
Kim, Subin committed
15
16
                {' '}KU#
            </Navbar.Brand>
이재연's avatar
이재연 committed
17
18
19
20
21
22
23
24
            <Nav>
                {user ? <Nav.Link className="text-light" onClick={() => handleLogout()}>Logout</Nav.Link>
                    : (
                        <>
                            <Nav.Link className="text-light" href='/login'>Login</Nav.Link>
                            <Nav.Link className="text-light" href='/signup'>Sign Up</Nav.Link>
                        </>
                    )}
Kim, Subin's avatar
Kim, Subin committed
25
                <Nav.Link href="/shoppingcart">
Jiwon Yoon's avatar
22    
Jiwon Yoon committed
26
                    <img alt="카트" src={cart} width="30" height="30" />
Kim, Subin's avatar
Kim, Subin committed
27
                </Nav.Link>
Kim, Subin's avatar
Kim, Subin committed
28
                <Nav.Link href="/admin">
Jiwon Yoon's avatar
22    
Jiwon Yoon committed
29
                    <img alt="관리자" src={option} width="30" height="30" />
Kim, Subin's avatar
Kim, Subin committed
30
31
32
                </Nav.Link>
            </Nav>
        </Navbar>
Kim, Subin's avatar
Kim, Subin committed
33
34
35
36
    )
}

export default MainNav