aboutsummaryrefslogtreecommitdiffstats
path: root/panel/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'panel/src/components')
-rw-r--r--panel/src/components/Navbar.css43
-rw-r--r--panel/src/components/Navbar.jsx54
2 files changed, 87 insertions, 10 deletions
diff --git a/panel/src/components/Navbar.css b/panel/src/components/Navbar.css
index 76713fb..e28724f 100644
--- a/panel/src/components/Navbar.css
+++ b/panel/src/components/Navbar.css
@@ -3,7 +3,28 @@
padding: 10px 20px;
display: flex;
justify-content: center;
+ align-items: center;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
+ position: relative;
+}
+
+.navbar-container {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ width: 100%;
+ max-width: 1200px;
+}
+
+.menu-icon {
+ color: white;
+ font-size: 2rem;
+ cursor: pointer;
+ width: 35px; /* Adjust the width */
+ height: 35px; /* Make it equal to width for a square */
+ display: none; /* Hidden by default */
+ justify-content: center;
+ align-items: center;
}
.navbar-list {
@@ -28,14 +49,30 @@
color: #FFEB3B;
}
+.mfp-hide {
+ display: none;
+}
+
@media (max-width: 768px) {
- .navbar {
- flex-direction: column;
- align-items: center;
+ .menu-icon {
+ display: flex; /* Show menu icon on mobile screens */
}
.navbar-list {
+ display: none; /* Hide regular menu list on mobile screens */
+ }
+
+ .navbar-list-popup {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+ display: flex;
flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ background: #2196F3;
+ width: 100%;
+ height: 100vh;
}
.navbar-item {
diff --git a/panel/src/components/Navbar.jsx b/panel/src/components/Navbar.jsx
index b287e97..d9632e3 100644
--- a/panel/src/components/Navbar.jsx
+++ b/panel/src/components/Navbar.jsx
@@ -1,16 +1,56 @@
-import React from 'react';
+import React, { useState, useEffect } from 'react';
import { Link } from 'react-router-dom';
+import MenuIcon from '@mui/icons-material/Menu';
+import CloseIcon from '@mui/icons-material/Close';
+import $ from 'jquery';
+import 'magnific-popup';
+import 'magnific-popup/dist/magnific-popup.css';
import './Navbar.css';
const Navbar = () => {
+ const [isMenuOpen, setIsMenuOpen] = useState(false);
+
+ const toggleMenu = () => {
+ if (!isMenuOpen) {
+ $.magnificPopup.open({
+ items: {
+ src: '#navbar-popup',
+ type: 'inline'
+ },
+ midClick: true,
+ closeOnBgClick: true,
+ callbacks: {
+ open: () => setIsMenuOpen(true),
+ close: () => setIsMenuOpen(false),
+ },
+ });
+ } else {
+ $.magnificPopup.close();
+ }
+ setIsMenuOpen(!isMenuOpen);
+ };
+
return (
<nav className="navbar">
- <ul className="navbar-list">
- <li className="navbar-item"><Link to="/dashboard">Dashboard</Link></li>
- <li className="navbar-item"><Link to="/manage-ads">Manage Ads</Link></li>
- <li className="navbar-item"><Link to="/roles">Roles</Link></li>
- <li className="navbar-item"><Link to="/logout">Logout</Link></li>
- </ul>
+ <div className="navbar-container">
+ <div className="menu-icon" onClick={toggleMenu}>
+ {isMenuOpen ? <CloseIcon /> : <MenuIcon />}
+ </div>
+ <ul className="navbar-list">
+ <li className="navbar-item"><Link to="/dashboard">Dashboard</Link></li>
+ <li className="navbar-item"><Link to="/manage-ads">Manage Ads</Link></li>
+ <li className="navbar-item"><Link to="/roles">Roles</Link></li>
+ <li className="navbar-item"><Link to="/logout">Logout</Link></li>
+ </ul>
+ <div id="navbar-popup" className="mfp-hide">
+ <ul className="navbar-list-popup">
+ <li className="navbar-item"><Link to="/dashboard">Dashboard</Link></li>
+ <li className="navbar-item"><Link to="/manage-ads">Manage Ads</Link></li>
+ <li className="navbar-item"><Link to="/roles">Roles</Link></li>
+ <li className="navbar-item"><Link to="/logout">Logout</Link></li>
+ </ul>
+ </div>
+ </div>
</nav>
);
};