cleanup
This commit is contained in:
9
src/app/_components/AdminWrap.tsx
Normal file
9
src/app/_components/AdminWrap.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
import { isAdmin } from "../actions"
|
||||
|
||||
export default async function AdminWrap({children,}: Readonly<{ children: React.ReactNode }>) {
|
||||
if (await isAdmin()) {
|
||||
return <>{children}</>
|
||||
}
|
||||
return (<></>)
|
||||
}
|
||||
|
||||
25
src/app/_components/TopNav.tsx
Normal file
25
src/app/_components/TopNav.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import Link from "next/link"
|
||||
import AdminWrap from "./AdminWrap"
|
||||
import { SignedIn, SignedOut, SignUpButton, UserButton } from "@clerk/nextjs"
|
||||
|
||||
export default function TopNav() {
|
||||
return (
|
||||
<nav className="flex flex-wrap items-center w-full border-b px-5 py-5 gap-5 bg-black text-white border-white">
|
||||
<Link className="h-fit" href={"/blog"}> Blog </Link>
|
||||
<Link className="h-fit" href={"/cv"}> CV </Link>
|
||||
<Link className="h-fit" href={"/projects"}> Projects </Link>
|
||||
<Link className="h-fit" href={"/fun"}> Fun </Link>
|
||||
<div className="ml-auto"/>
|
||||
<AdminWrap><Link className="h-fit" href={"/admin"}> Admin </Link></AdminWrap>
|
||||
<div className="h-fit flex">
|
||||
<SignedIn>
|
||||
<UserButton/>
|
||||
</SignedIn>
|
||||
<SignedOut>
|
||||
<SignUpButton/>
|
||||
</SignedOut>
|
||||
</div>
|
||||
</nav>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user