MainNav.js 1.26 KB
Newer Older
1
import React from 'react';
Kim, Subin's avatar
Kim, Subin committed
2
import { Navbar, Nav } from 'react-bootstrap';
3
import { handleLogout, isAuthenticated } from '../utils/auth';
Kim, Subin's avatar
Kim, Subin committed
4
5

function MainNav() {
이재연's avatar
이재연 committed
6
    const user = isAuthenticated()
Kim, Subin's avatar
Kim, Subin committed
7
8

    return (
Kim, Subin's avatar
Kim, Subin committed
9
10
        <Navbar sticky="top" style={{ background: "#CDC5C2" }}>
            <Navbar.Brand href="/home" className="text-light">
11
                <img alt="로고" src="/icon/footprint.svg" width="24" height="24" />
Kim, Subin's avatar
Kim, Subin committed
12
13
                {' '}KU#
            </Navbar.Brand>
Jiwon Yoon's avatar
Jiwon Yoon committed
14
            <Nav className="ml-auto">
이재연's avatar
이재연 committed
15
16
17
18
19
20
21
                {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
22
                <Nav.Link href="/shoppingcart">
23
                    <img alt="카트" src="/icon/cart.svg" width="30" height="30" />
Kim, Subin's avatar
Kim, Subin committed
24
                </Nav.Link>
Kim, Subin's avatar
Kim, Subin committed
25
                <Nav.Link href="/admin">
26
                    <img alt="관리자" src="/icon/option.svg" width="30" height="30" />
Kim, Subin's avatar
Kim, Subin committed
27
28
29
                </Nav.Link>
            </Nav>
        </Navbar>
Kim, Subin's avatar
Kim, Subin committed
30
31
32
33
    )
}

export default MainNav