import { JSXElement, Show, useContext } from "solid-js";
import { A } from "@solidjs/router";
import { LoginContext } from "./Root";
import { ModalContext } from "./Root";
import { Flake, Home, Plus, UserCircle } from "./Icons";
// Represents a single list item in the menu bar
function MenuItem(props: { href: string; children: JSXElement }): JSXElement {
return (
{props.children}
);
}
// Represents the menu bar at the top of the page
function Menu(): JSXElement {
const login_ctx = useContext(LoginContext);
return (
);
}
export function Navbar(): JSXElement {
const modal_ctx = useContext(ModalContext);
const login_ctx = useContext(LoginContext);
const logout = (): void => {
localStorage.removeItem("token");
localStorage.removeItem("username");
login_ctx?.setToken("");
login_ctx?.setUsername("");
};
const clickHandler = (): void => {
if (login_ctx?.token() != "") logout();
else modal_ctx?.setLoginModalOpen(true);
};
return (
);
}