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 +++++++++++++++++++++++++++++++++++------ panel/src/pages/Dashboard.css | 15 +++++++++--- 3 files changed, 99 insertions(+), 13 deletions(-) (limited to 'panel/src') 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 ( ); }; diff --git a/panel/src/pages/Dashboard.css b/panel/src/pages/Dashboard.css index 024df9b..49a11ed 100644 --- a/panel/src/pages/Dashboard.css +++ b/panel/src/pages/Dashboard.css @@ -19,7 +19,7 @@ .dashboard-header { text-align: center; - margin-bottom: 30px; + margin-bottom: 10px; } .dashboard-header h4 { @@ -43,6 +43,7 @@ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); } + .stat-card h6 { font-size: 16px; color: #666; @@ -55,10 +56,18 @@ } .chart-container { - margin-top: 30px; + margin-top: 20px; } .chart-container canvas { width: 100% !important; - height: 400px !important; + height: 100% !important; +} + +@media (max-width: 768px) { + .stat-card { + margin: 0px 4px; + padding: 10px; + text-align: center; + } } -- cgit v1.2.3-59-g8ed1b