Skip to content

Commit

Permalink
Created navigation bar for root layout
Browse files Browse the repository at this point in the history
  • Loading branch information
abedmohammed committed Nov 4, 2023
1 parent aaef00e commit cc0b0f1
Show file tree
Hide file tree
Showing 4 changed files with 162 additions and 1 deletion.
19 changes: 19 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.14.14",
"@mui/material": "^5.14.14",
"mui-image": "^1.0.7",
"next": "13.5.6",
"react": "^18",
"react-dom": "^18",
Expand Down
8 changes: 7 additions & 1 deletion frontend/src/components/Layout.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import React from "react";
import NavigationBar from "./NavigationBar";

const Layout = ({ children }) => {
return <div>{children}</div>;
return (
<>
<NavigationBar />
{children}
</>
);
};
export default Layout;
135 changes: 135 additions & 0 deletions frontend/src/components/NavigationBar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
import * as React from "react";
import AppBar from "@mui/material/AppBar";
import Box from "@mui/material/Box";
import Toolbar from "@mui/material/Toolbar";
import IconButton from "@mui/material/IconButton";
import Typography from "@mui/material/Typography";
import Menu from "@mui/material/Menu";
import MenuIcon from "@mui/icons-material/Menu";
import Container from "@mui/material/Container";
import Button from "@mui/material/Button";
import MenuItem from "@mui/material/MenuItem";
import AutoMateLogo from "../../public/Automate_logo.png";
import Image from "next/image";
import Link from "next/link";

const pages = ["upload", "profiling", "machine learning"];

function NavigationBar() {
const [anchorElNav, setAnchorElNav] = React.useState(null);

const handleOpenNavMenu = (event) => {
setAnchorElNav(event.currentTarget);
};

const handleCloseNavMenu = () => {
setAnchorElNav(null);
};

return (
<AppBar position="static">
<Container maxWidth="xl">
<Toolbar disableGutters>
<Box sx={{ display: { xs: "none", md: "flex" }, mr: 1 }}>
<Image width={50} alt="AutoMate Logo" src={AutoMateLogo} />
</Box>
<Typography
variant="h6"
noWrap
component="a"
href="/"
sx={{
ml: 2,
mr: 2,
display: { xs: "none", md: "flex" },
fontFamily: "monospace",
fontWeight: 700,
letterSpacing: ".3rem",
color: "inherit",
textDecoration: "none",
}}
>
AutoMate
</Typography>

<Box sx={{ flexGrow: 1, display: { xs: "flex", md: "none" } }}>
<IconButton
size="large"
aria-label="Menu Hamburger"
aria-controls="menu-appbar"
aria-haspopup="true"
onClick={handleOpenNavMenu}
color="inherit"
>
<MenuIcon />
</IconButton>
<Menu
id="menu-appbar"
anchorEl={anchorElNav}
anchorOrigin={{
vertical: "bottom",
horizontal: "left",
}}
keepMounted
transformOrigin={{
vertical: "top",
horizontal: "left",
}}
open={Boolean(anchorElNav)}
onClose={handleCloseNavMenu}
sx={{
display: { xs: "block", md: "none" },
}}
>
{pages.map((page) => (
<MenuItem
key={page}
onClick={handleCloseNavMenu}
component={Link}
href={page.replace(" ", "-")}
>
<Typography textAlign="center">{page}</Typography>
</MenuItem>
))}
</Menu>
</Box>

<Box sx={{ display: { xs: "flex", md: "none" }, mr: 1 }}>
<Image width={50} alt="AutoMate Logo" src={AutoMateLogo} />
</Box>
<Typography
variant="h5"
noWrap
component="a"
href="/"
sx={{
mr: 2,
display: { xs: "flex", md: "none" },
flexGrow: 1,
fontFamily: "monospace",
fontWeight: 700,
letterSpacing: ".3rem",
color: "inherit",
textDecoration: "none",
}}
>
AutoMate
</Typography>
<Box sx={{ flexGrow: 1, display: { xs: "none", md: "flex" } }}>
{pages.map((page) => (
<Button
key={page}
LinkComponent={Link}
href={page.replace(" ", "-")}
sx={{ my: 2, color: "white", display: "block" }}
>
{page}
</Button>
))}
</Box>
</Toolbar>
</Container>
</AppBar>
);
}
export default NavigationBar;

0 comments on commit cc0b0f1

Please sign in to comment.