Runs page in navbar
This commit is contained in:
@@ -1,29 +0,0 @@
|
|||||||
import Link, { LinkProps } from "next/link";
|
|
||||||
import { forwardRef } from "react";
|
|
||||||
import { cn } from "@/lib/utils";
|
|
||||||
import { usePathname } from "next/navigation";
|
|
||||||
|
|
||||||
interface NavLinkCompatProps extends Omit<LinkProps, "className"> {
|
|
||||||
className?: string;
|
|
||||||
activeClassName?: string;
|
|
||||||
pendingClassName?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const NavLink = forwardRef<HTMLAnchorElement, NavLinkCompatProps>(
|
|
||||||
({ className, activeClassName, pendingClassName, href, ...props }, ref) => {
|
|
||||||
const pathname = usePathname();
|
|
||||||
const isActive = pathname === href;
|
|
||||||
const isPending = false;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Link
|
|
||||||
ref={ref}
|
|
||||||
href={href}
|
|
||||||
className={cn(className, isActive && activeClassName, isPending && pendingClassName)}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
NavLink.displayName = "NavLink";
|
|
||||||
@@ -11,16 +11,16 @@ const navs = [
|
|||||||
icon: Zap,
|
icon: Zap,
|
||||||
name: "Problems",
|
name: "Problems",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
link: "/run",
|
|
||||||
icon: Timer,
|
|
||||||
name: "Run",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
link: "/leaderboards",
|
link: "/leaderboards",
|
||||||
icon: Trophy,
|
icon: Trophy,
|
||||||
name: "Leaderboards",
|
name: "Leaderboards",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
link: "/runs",
|
||||||
|
icon: Timer,
|
||||||
|
name: "Runs",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
link: "/profile",
|
link: "/profile",
|
||||||
icon: User,
|
icon: User,
|
||||||
|
|||||||
Reference in New Issue
Block a user