2024-04-16 13:40:25 -07:00
|
|
|
"use client";
|
|
|
|
|
2024-04-16 06:59:20 -07:00
|
|
|
import GitHubStarCount from "@/components/github-star-count";
|
2024-04-15 19:31:55 -07:00
|
|
|
import MinecraftButton from "@/components/minecraft-button";
|
2024-04-16 06:59:20 -07:00
|
|
|
import { Skeleton } from "@/components/ui/skeleton";
|
2024-04-15 15:00:47 -07:00
|
|
|
import config from "@/config";
|
2024-04-15 19:31:55 -07:00
|
|
|
import { minecrafter } from "@/font/fonts";
|
|
|
|
import { cn } from "@/lib/utils";
|
|
|
|
import { StarIcon } from "@heroicons/react/24/outline";
|
2024-04-15 19:53:23 -07:00
|
|
|
import Image from "next/image";
|
2024-04-15 15:00:47 -07:00
|
|
|
import Link from "next/link";
|
2024-04-16 13:40:25 -07:00
|
|
|
import { usePathname } from "next/navigation";
|
2024-04-16 06:59:20 -07:00
|
|
|
import { Suspense } from "react";
|
2024-04-15 15:00:47 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The navbar for the site.
|
|
|
|
*
|
|
|
|
* @returns the navbar jsx
|
|
|
|
*/
|
2024-04-16 13:40:25 -07:00
|
|
|
const Navbar = (): JSX.Element => {
|
|
|
|
const path: string = usePathname(); // Get the current path
|
|
|
|
return (
|
|
|
|
<nav className="fixed inset-x-0 flex h-16 px-12 justify-center sm:justify-between items-center bg-navbar-background z-50">
|
|
|
|
{/* Left */}
|
|
|
|
<div className="flex gap-7 lg:gap-12 items-center transition-all transform-gpu">
|
|
|
|
{/* App Branding */}
|
|
|
|
<Link
|
|
|
|
className={cn(
|
2024-04-17 06:43:14 -07:00
|
|
|
"hidden sm:flex text-3xl text-minecraft-green-3 hover:opacity-85 transition-all transform-gpu",
|
2024-04-16 13:40:25 -07:00
|
|
|
minecrafter.className
|
|
|
|
)}
|
|
|
|
href="/"
|
|
|
|
>
|
|
|
|
{/* Small Screens */}
|
|
|
|
<Image
|
|
|
|
className="hidden sm:flex lg:hidden"
|
|
|
|
src="/media/logo.webp"
|
|
|
|
alt="Site Logo"
|
|
|
|
width={42}
|
|
|
|
height={42}
|
|
|
|
/>
|
2024-04-15 19:53:23 -07:00
|
|
|
|
2024-04-16 13:40:25 -07:00
|
|
|
{/* Large Screens */}
|
|
|
|
<span className="hidden lg:flex">{config.siteName}</span>
|
|
|
|
</Link>
|
|
|
|
|
|
|
|
{/* Links */}
|
|
|
|
<div className="flex gap-7">
|
|
|
|
{Object.entries(config.navbarLinks).map((link, index) => {
|
|
|
|
const url: string = link[1]; // The href of the link
|
|
|
|
let active: boolean = path.startsWith(url); // Is this the active link?
|
|
|
|
return (
|
|
|
|
<Link
|
|
|
|
key={index}
|
|
|
|
className={cn(
|
|
|
|
"font-semibold uppercase hover:text-minecraft-green-4 transition-all transform-gpu",
|
|
|
|
active && "text-minecraft-green-4"
|
|
|
|
)}
|
|
|
|
href={url}
|
|
|
|
>
|
|
|
|
{link[0]}
|
|
|
|
</Link>
|
|
|
|
);
|
|
|
|
})}
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-04-15 19:31:55 -07:00
|
|
|
|
2024-04-17 06:35:22 -07:00
|
|
|
{/* Social Buttons - Right */}
|
2024-04-16 13:40:25 -07:00
|
|
|
<div className="hidden md:flex">
|
|
|
|
{/* Star on Github <3 */}
|
2024-04-16 20:15:09 -07:00
|
|
|
<Link
|
|
|
|
href="https://github.com/Rainnny7/RESTfulMC"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
target="_blank"
|
|
|
|
>
|
2024-04-17 06:35:22 -07:00
|
|
|
<MinecraftButton className="flex gap-1.5 items-center group/star">
|
2024-04-16 13:40:25 -07:00
|
|
|
{/* Star Count */}
|
|
|
|
<Suspense fallback={<Skeleton className="w-4 h-5 rounded-md" />}>
|
|
|
|
<GitHubStarCount />
|
|
|
|
</Suspense>
|
|
|
|
|
|
|
|
<StarIcon
|
|
|
|
className="group-hover/star:text-orange-400 delay-0 transition-all transform-gpu"
|
|
|
|
width={22}
|
|
|
|
height={22}
|
|
|
|
/>
|
|
|
|
<span>Star on GitHub</span>
|
2024-04-16 20:15:09 -07:00
|
|
|
</MinecraftButton>
|
|
|
|
</Link>
|
2024-04-15 19:31:55 -07:00
|
|
|
</div>
|
2024-04-16 13:40:25 -07:00
|
|
|
</nav>
|
|
|
|
);
|
|
|
|
};
|
2024-04-15 15:00:47 -07:00
|
|
|
export default Navbar;
|