main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
1.5 KB
|
Rev | Line | |
---|
[d565449] | 1 | import React, { useState, useEffect } from "react";
|
---|
| 2 | import { Button } from "./Button";
|
---|
| 3 | import "./Navbar.css";
|
---|
| 4 | import { Link } from "react-router-dom";
|
---|
| 5 | import logo from "../../../assets/logo_icon.png";
|
---|
| 6 |
|
---|
| 7 | function Navbar() {
|
---|
| 8 | const [click, setClick] = useState(false);
|
---|
| 9 | const [button, setButton] = useState(true);
|
---|
| 10 |
|
---|
| 11 | const handleClick = () => setClick(!click);
|
---|
| 12 | const closeMobileMenu = () => setClick(false);
|
---|
| 13 |
|
---|
| 14 | const showButton = () => {
|
---|
| 15 | if (window.innerWidth <= 960) {
|
---|
| 16 | setButton(false);
|
---|
| 17 | } else {
|
---|
| 18 | setButton(true);
|
---|
| 19 | }
|
---|
| 20 | };
|
---|
| 21 |
|
---|
| 22 | useEffect(() => {
|
---|
| 23 | showButton();
|
---|
| 24 | }, []);
|
---|
| 25 |
|
---|
| 26 | window.addEventListener("resize", showButton);
|
---|
| 27 |
|
---|
| 28 | return (
|
---|
| 29 | <>
|
---|
| 30 | <nav className="navbar">
|
---|
| 31 | <div className="navbar-container">
|
---|
| 32 | <a href="#" className="navbar-logo pad-bot" onClick={closeMobileMenu}>
|
---|
| 33 | iMaps
|
---|
| 34 | </a>
|
---|
| 35 | <div className="menu-icon" onClick={handleClick}>
|
---|
| 36 | <i className={click ? "fas fa-times" : "fas fa-bars"} />
|
---|
| 37 | </div>
|
---|
| 38 | <ul className={click ? "nav-menu active" : "nav-menu"}>
|
---|
| 39 | <Link to="/Signup">
|
---|
| 40 | <li className="nav-item">
|
---|
| 41 | <a href="#" className="nav-links" onClick={closeMobileMenu}>
|
---|
| 42 | SignUp
|
---|
| 43 | </a>
|
---|
| 44 | </li>
|
---|
| 45 | </Link>
|
---|
| 46 | </ul>
|
---|
| 47 | <div className="pad-bot">
|
---|
| 48 | <Link to="/Login">{button && <Button buttonStyle="btn--outline">LOG IN</Button>}</Link>
|
---|
| 49 | </div>
|
---|
| 50 | </div>
|
---|
| 51 | </nav>
|
---|
| 52 | </>
|
---|
| 53 | );
|
---|
| 54 | }
|
---|
| 55 |
|
---|
| 56 | export default Navbar;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.