Skip to content

Commit

Permalink
馃悰 useNavLinkProvider in top navigation (#378)
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanc1 committed May 9, 2024
1 parent 9881e99 commit 6e45b03
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/red-sheep-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@myst-theme/site': patch
---

Change to NavLink provider for internal links
4 changes: 3 additions & 1 deletion packages/site/src/components/Navigation/TopNav.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { NavLink } from '@remix-run/react';
import { Fragment } from 'react';
import classNames from 'classnames';
import { Menu, Transition } from '@headlessui/react';
Expand All @@ -12,6 +11,7 @@ import { ThemeButton } from './ThemeButton.js';
import {
useBaseurl,
useLinkProvider,
useNavLinkProvider,
useNavOpen,
useSiteManifest,
withBaseurl,
Expand All @@ -34,6 +34,7 @@ function ExternalOrInternalLink({
prefetch?: 'intent' | 'render' | 'none';
}) {
const Link = useLinkProvider();
const NavLink = useNavLinkProvider();
const staticClass = typeof className === 'function' ? className({ isActive: false }) : className;
if (to.startsWith('http') || to.startsWith('mailto:')) {
return (
Expand All @@ -57,6 +58,7 @@ function ExternalOrInternalLink({
}

function NavItem({ item }: { item: SiteNavItem }) {
const NavLink = useNavLinkProvider();
if (!('children' in item)) {
return (
<div className="relative inline-block mx-2 grow-0">
Expand Down

0 comments on commit 6e45b03

Please sign in to comment.