makearmy-app/components/PortalTabs.tsx

50 lines
1.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// components/PortalTabs.tsx
"use client";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { cn } from "@/lib/utils"; // or roll your own `cn` if you dont have one
const tabs = [
{ href: "/portal", label: "Home" },
{ href: "/portal/rigs", label: "Rigs" },
{ href: "/portal/laser-settings", label: "Laser Settings" },
{ href: "/portal/laser-sources", label: "Laser Sources" },
{ href: "/portal/materials", label: "Materials" },
{ href: "/portal/projects", label: "Projects" },
{ href: "/portal/utilities", label: "Utilities" },
{ href: "/portal/account", label: "Account" },
];
export default function PortalTabs() {
const pathname = usePathname() || "/portal";
return (
<nav className="flex flex-wrap items-center gap-1 rounded-md border bg-background p-1">
{tabs.map((t) => {
const active =
pathname === t.href ||
(t.href !== "/portal" && pathname.startsWith(t.href));
return (
<Link
key={t.href}
href={t.href}
className={cn(
"px-3 py-1.5 text-sm rounded-md transition",
active
? "bg-primary text-primary-foreground"
: "hover:bg-muted"
)}
>
{t.label}
</Link>
);
})}
<div className="ml-auto px-3 py-1.5 text-xs opacity-60">
MakerDash
</div>
</nav>
);
}