[e9b4ba9] | 1 | import { Button } from "react-bootstrap";
|
---|
| 2 | import React from "react";
|
---|
| 3 | import { Container, Image, Navbar } from "react-bootstrap";
|
---|
| 4 | import { Nav } from "react-bootstrap";
|
---|
| 5 | import { BsFillPersonFill } from "react-icons/bs";
|
---|
| 6 | import { useNavigate } from "react-router-dom";
|
---|
| 7 | import useGet from "../../Hooks/useGet";
|
---|
| 8 | import axios from "../../../axios.js";
|
---|
| 9 | //import logo from 'assets/images/logo.png';
|
---|
| 10 | //src="https://upload.wikimedia.org/wikipedia/commons/0/08/Vergina_Sun_-_Golden_Larnax.png"
|
---|
| 11 |
|
---|
| 12 | function Navigation(props) {
|
---|
| 13 | const navigator = useNavigate();
|
---|
| 14 |
|
---|
| 15 | const { data, setData, isLoading, getData } = useGet("/username");
|
---|
| 16 |
|
---|
| 17 | return (
|
---|
| 18 | <>
|
---|
| 19 | <Navbar
|
---|
| 20 | bg="white"
|
---|
| 21 | variant="white"
|
---|
| 22 | expand="md"
|
---|
| 23 | className={props.mt == "0" ? "px-5 m-4" : ""}
|
---|
| 24 | >
|
---|
| 25 | <Container>
|
---|
| 26 | <Navbar.Brand href="#home">
|
---|
| 27 | <span className="ikona">
|
---|
| 28 | <Image
|
---|
| 29 | id="background-img"
|
---|
| 30 | src="https://i.ibb.co/BwtmZqX/logo.png"
|
---|
| 31 | width={60}
|
---|
| 32 | height={60}
|
---|
| 33 | ></Image>
|
---|
| 34 | </span>
|
---|
| 35 | <span className="mx-3 ikona">
|
---|
| 36 | <span className="svetlo">Tour</span>
|
---|
| 37 | <span className="temno">Mate</span>
|
---|
| 38 | </span>
|
---|
| 39 | </Navbar.Brand>
|
---|
| 40 | <Navbar.Toggle aria-controls="navbarScroll" />
|
---|
| 41 | <Navbar.Collapse id="navbarScroll">
|
---|
| 42 | <Nav className="ms-auto" navbarScroll>
|
---|
| 43 | <Nav.Link className="m-2" href="/home">
|
---|
| 44 | Home
|
---|
| 45 | </Nav.Link>
|
---|
| 46 | <Nav.Link className="m-2" href="#features">
|
---|
| 47 | Features
|
---|
| 48 | </Nav.Link>
|
---|
| 49 | <Nav.Link className="m-2" href="#pricing">
|
---|
| 50 | Pricing
|
---|
| 51 | </Nav.Link>
|
---|
| 52 | {!isLoading && !data && (
|
---|
| 53 | <Button
|
---|
| 54 | className="m-2"
|
---|
| 55 | size="md"
|
---|
| 56 | style={{ backgroundColor: "#159895" }}
|
---|
| 57 | onClick={() => {
|
---|
| 58 | navigator("/login");
|
---|
| 59 | }}
|
---|
| 60 | >
|
---|
| 61 | <BsFillPersonFill size={"1.5em"}></BsFillPersonFill> Најави се
|
---|
| 62 | </Button>
|
---|
| 63 | )}
|
---|
| 64 | {!isLoading && data && (
|
---|
| 65 | <>
|
---|
| 66 | <Nav.Link className="m-2" href="/profile">
|
---|
| 67 | {data}
|
---|
| 68 | </Nav.Link>
|
---|
| 69 | <Button
|
---|
| 70 | className="m-2"
|
---|
| 71 | size="md"
|
---|
| 72 | style={{ backgroundColor: "#159895" }}
|
---|
| 73 | onClick={async () => {
|
---|
| 74 | await axios.get("/logout")
|
---|
| 75 | .then((res) => {
|
---|
| 76 | console.log(res)
|
---|
| 77 | })
|
---|
| 78 | .catch((err) => {
|
---|
| 79 | console.log(err)
|
---|
| 80 | window.location.href="/login"
|
---|
| 81 | })
|
---|
| 82 | }}
|
---|
| 83 | >
|
---|
| 84 | <BsFillPersonFill size={"1.5em"}></BsFillPersonFill>
|
---|
| 85 | Одјави се
|
---|
| 86 | </Button>
|
---|
| 87 | </>
|
---|
| 88 | )}
|
---|
| 89 | </Nav>
|
---|
| 90 | </Navbar.Collapse>
|
---|
| 91 | </Container>
|
---|
| 92 | </Navbar>
|
---|
| 93 | <br />
|
---|
| 94 | </>
|
---|
| 95 | );
|
---|
| 96 | }
|
---|
| 97 |
|
---|
| 98 | export default Navigation;
|
---|