You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
10 lines
409 B
TypeScript
10 lines
409 B
TypeScript
import { usePageContext } from "vike-react/usePageContext";
|
|
import { NavLink } from "@mantine/core";
|
|
|
|
export function Link({ href, label }: { href: string; label: string }) {
|
|
const pageContext = usePageContext();
|
|
const { urlPathname } = pageContext;
|
|
const isActive = href === "/" ? urlPathname === href : urlPathname.startsWith(href);
|
|
return <NavLink href={href} label={label} active={isActive} />;
|
|
}
|