import { useState } from "react";
import { IconButton, useTheme } from "@mui/material";
import MenuIcon from "@mui/icons-material/Menu";
import { Link } from "react-router-dom";

import SectionWrapper from "../SectionWrapper";

import PenaLogo from "../PenaLogo";
import DialogMenu from "./DialogMenu";

interface Props {
  isLoggedIn: boolean;
}

export default function NavbarCollapsed({ isLoggedIn }: Props) {
  const [open, setOpen] = useState(false);

  const theme = useTheme();

  return (
    <SectionWrapper
      component="nav"
      maxWidth="lg"
      outerContainerSx={{
        zIndex: "111111111111",
        position: "fixed",
        top: "0",
        backgroundColor: theme.palette.bg.main,
        borderBottom: "1px solid #E3E3E3",
      }}
      sx={{
        height: "51px",
        py: "6px",
        display: "flex",
        justifyContent: "space-between",
        alignItems: "center",
      }}
    >
      <Link to="/">
        <PenaLogo width={100} color="black" />
      </Link>

      <IconButton
        onClick={() => setOpen(!open)}
        sx={{ p: 0, width: "30px", color: theme.palette.primary.main, zIndex: "2" }}
      >
        <MenuIcon sx={{ height: "30px", width: "30px" }} />
      </IconButton>
      <DialogMenu open={open} handleClose={() => setOpen(false)} />
    </SectionWrapper>
  );
}
