Commit 4d454d21 authored by Ken's avatar Ken

feat: add logo and sticky navbar

parent 2a97d85c
@use "styles/index" as *; @use "styles/index" as *;
.header { .header {
&-logo {
width: 40px;
height: 40px;
cursor: pointer;
img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
@include desktop {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
}
&-toolbar { &-toolbar {
padding: 0 !important; padding: 0;
justify-content: center; justify-content: center;
@include desktop { @include desktop {
padding: 0 20px !important; padding: 0 20px;
justify-content: flex-start; justify-content: flex-start;
} }
&__iconDrawer { &__tablet {
display: none !important; display: none;
@include desktop { @include desktop {
display: inline-flex !important; display: block;
}
.iconDrawer {
} }
} }
......
import { Box } from "@mui/material";
import { PageUrl } from "configuration/enum";
import React from "react";
import { useNavigate } from "react-router-dom";
const HeaderLogo = () => {
const navigate = useNavigate();
return (
<Box className="header-logo" onClick={() => navigate(PageUrl.ROOT)}>
<img
src="https://meu-solutions.com/wp-content/uploads/2020/08/MeU-logo-newest-08-150.png"
alt="logo"
/>
</Box>
);
};
export default HeaderLogo;
...@@ -4,8 +4,6 @@ import Box from "@mui/material/Box"; ...@@ -4,8 +4,6 @@ import Box from "@mui/material/Box";
import IconButton from "@mui/material/IconButton"; import IconButton from "@mui/material/IconButton";
import MenuIcon from "@mui/icons-material/Menu"; import MenuIcon from "@mui/icons-material/Menu";
import Toolbar from "@mui/material/Toolbar"; import Toolbar from "@mui/material/Toolbar";
import Button from "@mui/material/Button";
import HomeIcon from "@mui/icons-material/Home";
import Sidenav from "../Sidenav"; import Sidenav from "../Sidenav";
import { Typography } from "@mui/material"; import { Typography } from "@mui/material";
import { useAppDispatch, useAppSelector } from "app/hooks"; import { useAppDispatch, useAppSelector } from "app/hooks";
...@@ -13,6 +11,8 @@ import { getCategories } from "./headerSlice"; ...@@ -13,6 +11,8 @@ import { getCategories } from "./headerSlice";
import { handleLoading } from "app/globalSlice"; import { handleLoading } from "app/globalSlice";
import { headerSelector } from "app/selectors"; import { headerSelector } from "app/selectors";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { PageUrl } from "configuration/enum";
import HeaderLogo from "./HeaderLogo";
export default function Header() { export default function Header() {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
...@@ -43,12 +43,13 @@ export default function Header() { ...@@ -43,12 +43,13 @@ export default function Header() {
}; };
return ( return (
<Box sx={{ display: "flex" }} className="header"> <>
<AppBar <AppBar
component="nav" component="nav"
position="sticky" position="sticky"
sx={{ background: "transparent", overflow: "hidden" }} sx={{ background: "white", overflow: "hidden" }}
> >
<Box className="header">
<Toolbar <Toolbar
sx={{ sx={{
display: "flex", display: "flex",
...@@ -57,24 +58,25 @@ export default function Header() { ...@@ -57,24 +58,25 @@ export default function Header() {
}} }}
className="header-toolbar" className="header-toolbar"
> >
<Box className="header-toolbar__tablet">
<IconButton <IconButton
color="inherit" color="inherit"
aria-label="open drawer" aria-label="open drawer"
edge="start" edge="start"
onClick={handleDrawerToggle} onClick={handleDrawerToggle}
sx={{ mr: 2 }} sx={{ mr: 2 }}
className="header-toolbar__iconDrawer" className="iconDrawer"
> >
<MenuIcon /> <MenuIcon />
</IconButton> </IconButton>
<HeaderLogo />
</Box>
<Box <Box
sx={{ gap: 2 }} sx={{ gap: 2 }}
ref={headerRef} ref={headerRef}
className="header-toolbar__navbar" className="header-toolbar__navbar"
> >
<Button sx={{ padding: 0, minWidth: "auto", color: "#000" }}> <HeaderLogo />
<HomeIcon />
</Button>
<Box <Box
className="header-list" className="header-list"
component="ul" component="ul"
...@@ -126,12 +128,13 @@ export default function Header() { ...@@ -126,12 +128,13 @@ export default function Header() {
</Box> </Box>
</Box> </Box>
</Toolbar> </Toolbar>
</Box>
</AppBar> </AppBar>
<Sidenav <Sidenav
handleDrawerToggle={handleDrawerToggle} handleDrawerToggle={handleDrawerToggle}
navItems={categoryData} navItems={categoryData}
mobileOpen={mobileOpen} mobileOpen={mobileOpen}
/> />
</Box> </>
); );
} }
import { StyledEngineProvider } from "@mui/material";
import React from "react"; import React from "react";
import ReactDOM from "react-dom/client"; import ReactDOM from "react-dom/client";
import { Provider } from "react-redux/es/exports"; import { Provider } from "react-redux/es/exports";
...@@ -10,7 +11,9 @@ const root = ReactDOM.createRoot( ...@@ -10,7 +11,9 @@ const root = ReactDOM.createRoot(
); );
root.render( root.render(
<Provider store={store}> <Provider store={store}>
<StyledEngineProvider injectFirst>
<Routers /> <Routers />
</StyledEngineProvider>
</Provider> </Provider>
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment