Commit 9e7620d9 authored by VeroSilva's avatar VeroSilva

Using the new palette on Navbar

parent eadfdcf2
import * as React from "react"; import * as React from "react"
import PropTypes from "prop-types"; import PropTypes from "prop-types"
import AppBar from "@mui/material/AppBar";
import Toolbar from "@mui/material/Toolbar"; import AppBar from "@mui/material/AppBar"
import Typography from "@mui/material/Typography"; import Toolbar from "@mui/material/Toolbar"
import useScrollTrigger from "@mui/material/useScrollTrigger"; import Typography from "@mui/material/Typography"
import Slide from "@mui/material/Slide"; import useScrollTrigger from "@mui/material/useScrollTrigger"
import Slide from "@mui/material/Slide"
import { import {
useTheme, useTheme,
useMediaQuery, useMediaQuery,
} from "@material-ui/core"; } from "@material-ui/core"
import Drawer from "./Drawer"
import { NavLink } from "./styled"
import theme from "./palette"
import Drawer from "./Drawer"; const myPalette = theme.palette
import { NavLink } from "./styled";
import { color } from "@mui/system";
function HideOnScroll(props) { function HideOnScroll(props) {
const { children, window } = props; const { children, window } = props
const trigger = useScrollTrigger({ const trigger = useScrollTrigger({
target: window ? window() : undefined, target: window ? window() : undefined,
}); })
return ( return (
<Slide appear={false} direction="down" in={!trigger}> <Slide appear={false} direction="down" in={!trigger}>
{children} {children}
</Slide> </Slide>
); )
} }
HideOnScroll.propTypes = { HideOnScroll.propTypes = {
children: PropTypes.element.isRequired, children: PropTypes.element.isRequired,
window: PropTypes.func, window: PropTypes.func,
}; }
function Navbar(props) { function Navbar(props) {
const theme = useTheme(); const theme = useTheme()
const isMobile = useMediaQuery(theme.breakpoints.down("sm")); const isMobile = useMediaQuery(theme.breakpoints.down("sm"))
return ( return (
<HideOnScroll {...props}> <HideOnScroll {...props}>
<AppBar <AppBar
sx={{ sx={{
backgroundColor: "#074B6B !important", backgroundColor: `${myPalette.primary.main} !important`,
px: { px: {
lg: 8, lg: 8,
}, },
color: { color: {
md: "#ffffff !important", md: `${myPalette.primary.contrastText} !important`,
sm: "#404040 !important" sm: `${myPalette.primary.text} !important`,
} }
}}> }}>
<Toolbar> <Toolbar>
...@@ -71,7 +75,7 @@ function Navbar(props) { ...@@ -71,7 +75,7 @@ function Navbar(props) {
</Toolbar> </Toolbar>
</AppBar> </AppBar>
</HideOnScroll> </HideOnScroll>
); )
}; };
export default Navbar; export default Navbar
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