From 2843285c5d4c995841d4ba5b0aee8fb0458f5d49 Mon Sep 17 00:00:00 2001 From: Biswakalyan Bhuyan Date: Sat, 3 Aug 2024 17:24:35 +0530 Subject: Fixed responsiveness of Navbar and Dashboard --- panel/src/components/Navbar.css | 43 +++++++++++++++++++++++++++++--- panel/src/components/Navbar.jsx | 54 +++++++++++++++++++++++++++++++++++------ 2 files changed, 87 insertions(+), 10 deletions(-) (limited to 'panel/src/components') 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 ( ); }; -- cgit v1.2.3-59-g8ed1b