From 361ef097c29a44d0eefff0e35b60a799dd94fc7d Mon Sep 17 00:00:00 2001 From: SySagar Date: Tue, 27 Feb 2024 02:29:24 +0530 Subject: [PATCH] fix: navbar responsive --- src/App.css | 13 ++ src/ui/EnigmaNavLink.jsx | 78 ++++++------ src/ui/Header.jsx | 257 +++++++++++++++++++++++++++++++-------- 3 files changed, 258 insertions(+), 90 deletions(-) diff --git a/src/App.css b/src/App.css index e69de29..1eb81f0 100644 --- a/src/App.css +++ b/src/App.css @@ -0,0 +1,13 @@ +.drawerStyles { + background: rgba( 0, 0, 0, 0.7 ); + box-shadow: 0 8px 32px 0 rgba( 31, 38, 135, 0.37 ); + backdrop-filter: blur( 12px ); + -webkit-backdrop-filter: blur( 20px ); + border: 1px solid rgba( 255, 255, 255, 0.18 ); +} + +.active{ + text-decoration: underline; + color: #5cdc21; + text-underline-offset: 7px; + } diff --git a/src/ui/EnigmaNavLink.jsx b/src/ui/EnigmaNavLink.jsx index e84875e..8c539ea 100644 --- a/src/ui/EnigmaNavLink.jsx +++ b/src/ui/EnigmaNavLink.jsx @@ -1,44 +1,44 @@ -import { Stack, Box, Typography } from "@mui/material" +import { Stack, Box, Typography } from "@mui/material"; -const EnigmaNavLink = ({ href = '/', color = 'text.body', children }) => { +const EnigmaNavLink = ({ + href = "/", + color = "text.body", + children, + ...props +}) => { return ( - - - { children } - + direction="row" + position="relative" + gap="8px" + {...props} + alignItems="center" + sx={{ + width: "fit-content", + "&:hover": { + "& .MuiBox-root": { + width: "100%", + }, + }, + }} + > + + {children} - - - ) -} + + + ); +}; -export default EnigmaNavLink +export default EnigmaNavLink; diff --git a/src/ui/Header.jsx b/src/ui/Header.jsx index d69ed51..8b4a2eb 100644 --- a/src/ui/Header.jsx +++ b/src/ui/Header.jsx @@ -1,69 +1,224 @@ -// import EnigmaLink from "@/components/common/EnigmaLink" -import { AppBar, Stack, Typography } from "@mui/material" -import EnigmaNavLink from "./EnigmaNavLink" +import React, { useState, useEffect } from "react"; +import { AppBar, Stack, Typography, Drawer } from "@mui/material"; +import useMediaQuery from "@mui/material/useMediaQuery"; +import MenuIcon from "@mui/icons-material/Menu"; +import IconButton from "@mui/material/IconButton"; +import EnigmaNavLink from "./EnigmaNavLink"; +import EventIcon from "@mui/icons-material/Event"; +import BookIcon from "@mui/icons-material/Book"; +import WebhookIcon from "@mui/icons-material/Webhook"; +import GroupsIcon from "@mui/icons-material/Groups"; +import Divider from "@mui/material/Divider"; +import "../App.css"; + +const DrawerList = ({ activeLink }) => ( + + + Enigma VSSUT logo + Enigma VSSUT + + + + + + + + Events + + + + + + + Blogs + + + + + + + Projects + + + + + + + Team + + + + + + © 2024 Enigma VSSUT + + +); const Header = () => { + const isPhone = useMediaQuery("(max-width:600px)"); + const [open, setOpen] = useState(false); + const [activeLink, setActiveLink] = useState(""); + + useEffect(() => { + const currentPath = window.location.pathname; + setActiveLink(currentPath); + }, [activeLink]); + + const toggleDrawer = (newOpen) => () => { + setOpen(newOpen); + }; + return ( - + direction="row" + borderBottom="1px solid" + borderColor="divider" + justifyContent="center" + alignItems="center" + padding="10px 32px" + gap="16px" + > + Enigma VSSUT logo - - Enigma VSSUT - - - - - Events - - - Blogs - - - Projects - - - Team - + Enigma VSSUT + {isPhone ? ( + <> + + + + + + + + ) : ( + + + Events + + + Blogs + + + Projects + + + Team + + + )} - ) -} + ); +}; -export default Header +export default Header;