diff --git a/src/qqq/components/horseshoe/NavBar.tsx b/src/qqq/components/horseshoe/NavBar.tsx index 3e15f5d..2b2ce9f 100644 --- a/src/qqq/components/horseshoe/NavBar.tsx +++ b/src/qqq/components/horseshoe/NavBar.tsx @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -import {Popper} from "@mui/material"; +import {Popper, InputAdornment} from "@mui/material"; import AppBar from "@mui/material/AppBar"; import Autocomplete from "@mui/material/Autocomplete"; import Badge from "@mui/material/Badge"; @@ -34,8 +34,8 @@ import React, {useContext, useEffect, useState} from "react"; import {useLocation, useNavigate} from "react-router-dom"; import QContext from "QContext"; import QBreadcrumbs, {routeToLabel} from "qqq/components/horseshoe/Breadcrumbs"; -import {navbar, navbarContainer, navbarIconButton, navbarRow,} from "qqq/components/horseshoe/Styles"; -import {setTransparentNavbar, useMaterialUIController,} from "qqq/context"; +import {navbar, navbarContainer, navbarRow, navbarMobileMenu, recentlyViewedMenu,} from "qqq/components/horseshoe/Styles"; +import {setTransparentNavbar, useMaterialUIController, setMiniSidenav} from "qqq/context"; import HistoryUtils from "qqq/utils/HistoryUtils"; // Declaring prop types for NavBar @@ -57,7 +57,7 @@ function NavBar({absolute, light, isMini}: Props): JSX.Element { const [navbarType, setNavbarType] = useState<"fixed" | "absolute" | "relative" | "static" | "sticky">(); const [controller, dispatch] = useMaterialUIController(); - const {transparentNavbar, fixedNavbar, darkMode,} = controller; + const {miniSidenav, transparentNavbar, fixedNavbar, darkMode,} = controller; const [openMenu, setOpenMenu] = useState(false); const [history, setHistory] = useState([] as HistoryEntry[]); const [autocompleteValue, setAutocompleteValue] = useState(null); @@ -105,6 +105,8 @@ function NavBar({absolute, light, isMini}: Props): JSX.Element return () => window.removeEventListener("scroll", handleTransparentNavbar); }, [dispatch, fixedNavbar]); + const handleMiniSidenav = () => setMiniSidenav(dispatch, !miniSidenav); + const goToHistory = (path: string) => { navigate(path); @@ -162,7 +164,15 @@ function NavBar({absolute, light, isMini}: Props): JSX.Element onChange={handleAutocompleteOnChange} PopperComponent={CustomPopper} isOptionEqualToValue={(option, value) => option.id === value.id} - renderInput={(params) => } + sx={recentlyViewedMenu} + renderInput={(params) => + keyboard_arrow_down + + ) + }} />} renderOption={(props, option: HistoryEntry) => ( @@ -175,22 +185,6 @@ function NavBar({absolute, light, isMini}: Props): JSX.Element ); } - - // Render the notifications menu - const renderMenu = () => ( - - ); - // Styles for the navbar icons const iconsStyle = ({ palette: {dark, white, text}, @@ -240,26 +234,22 @@ function NavBar({absolute, light, isMini}: Props): JSX.Element > navbarRow(theme, {isMini})}> + + menu + {isMini ? null : ( navbarRow(theme, {isMini})}> - + {renderHistory()} - - - - notifications - - - {renderMenu()} - )} diff --git a/src/qqq/components/horseshoe/Styles.ts b/src/qqq/components/horseshoe/Styles.ts index b118a5c..975128e 100644 --- a/src/qqq/components/horseshoe/Styles.ts +++ b/src/qqq/components/horseshoe/Styles.ts @@ -110,11 +110,10 @@ const navbarContainer = ({breakpoints}: Theme): any => ({ const navbarRow = ({breakpoints}: Theme, {isMini}: any) => ({ display: "flex", alignItems: "center", - justifyContent: "space-between", width: "100%", [breakpoints.up("md")]: { - justifyContent: isMini ? "space-between" : "stretch", + justifyContent: "stretch", width: isMini ? "100%" : "max-content", }, @@ -146,12 +145,27 @@ const navbarDesktopMenu = ({breakpoints}: Theme) => ({ display: "none !important", cursor: "pointer", - [breakpoints.up("xl")]: { + [breakpoints.down("sm")]: { display: "inline-block !important", }, }); +const recentlyViewedMenu = ({breakpoints}: Theme) => ({ + "& .MuiOutlinedInput-root": { + borderRadius: "0", + padding: "0" + }, + "& .MuiOutlinedInput-root .MuiOutlinedInput-notchedOutline": { + border: "0" + }, + display: "block", + [breakpoints.down("md")]: { + display: "none !important", + }, +}); + const navbarMobileMenu = ({breakpoints}: Theme) => ({ + left: "-0.75rem", display: "inline-block", lineHeight: 0, @@ -167,4 +181,5 @@ export { navbarIconButton, navbarDesktopMenu, navbarMobileMenu, + recentlyViewedMenu };