This commit is contained in:
@@ -4,6 +4,7 @@ import { useState } from "react";
|
||||
import React from "react";
|
||||
import { navBarFont } from "./fonts";
|
||||
import {
|
||||
ADMIN_PAGES,
|
||||
PAGES,
|
||||
Pages,
|
||||
pathNameFromSelectedPage,
|
||||
@@ -11,7 +12,7 @@ import {
|
||||
} from "./pages";
|
||||
import { usePathname, useRouter } from "next/navigation";
|
||||
|
||||
export default function Navbar() {
|
||||
export default function Navbar({ isLoggedIn }: { isLoggedIn: boolean }) {
|
||||
const [hoveredPage, setHoveredPage] = useState<Pages | null>(null);
|
||||
|
||||
const pathName = usePathname();
|
||||
@@ -41,7 +42,10 @@ export default function Navbar() {
|
||||
justifyContent: "center",
|
||||
}}
|
||||
>
|
||||
{PAGES.map((page, index) => (
|
||||
{PAGES.filter((p) => {
|
||||
if (!isLoggedIn && ADMIN_PAGES.includes(p)) return false;
|
||||
return true;
|
||||
}).map((page, index) => (
|
||||
<React.Fragment key={page}>
|
||||
<div
|
||||
style={navbarItem(page)}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
export type Pages = "home" | "about" | "links" | "contact" | "blog";
|
||||
export const PAGES: Pages[] = ["home", "about", "blog", "links", "contact"];
|
||||
export type Pages = "home" | "about" | "links" | "contact" | "blog" | "clipboard";
|
||||
export const PAGES: Pages[] = ["home", "about", "blog", "links", "contact", "clipboard"];
|
||||
export const ADMIN_PAGES: Pages[] = ["clipboard"]
|
||||
|
||||
export function selectedPageFromPathName(pathName: string): Pages {
|
||||
if (pathName === "/") {
|
||||
|
||||
Reference in New Issue
Block a user