Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

Commit

Permalink
Get highlighting to work
Browse files Browse the repository at this point in the history
  • Loading branch information
ptgott committed Jul 17, 2024
1 parent 1c66628 commit 9f0596b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion layouts/DocsPage/Navigation.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const NavigationFourLevels = () => {
slug: "/enroll-resources/machine-id/deployment/",
entries: [
{
title: "Deploy Machine ID on AWs",
title: "Deploy Machine ID on AWS",
slug: "/enroll-resources/machine-id/deployment/aws/",
},
],
Expand Down
10 changes: 8 additions & 2 deletions layouts/DocsPage/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,16 @@ const DocsNavigationItems = ({
const docPath = currentPath.split(SCOPELESS_HREF_REGEX)[0];
const { getVersionAgnosticRoute } = useVersionAgnosticPages();

console.log("entries:", entries);

return (
<>
{!!entries.length &&
entries.map((entry) => {
const selected = entry.slug === docPath;
const active =
selected || entry.entries?.some((entry) => entry.slug === docPath);
selected ||
entry.entries?.some((entry) => docPath.includes(entry.slug));

return (
<li key={entry.slug}>
Expand Down Expand Up @@ -152,8 +155,11 @@ const DocNavigation = ({
data,
section,
currentVersion,
currentPathGetter = { useCurrentHref },
currentPathGetter,
}: DocNavigationProps) => {
if (!currentPathGetter) {
currentPathGetter = useCurrentHref;
}
const route = currentPathGetter();

const [openedId, setOpenedId] = useState<number>(
Expand Down

0 comments on commit 9f0596b

Please sign in to comment.