Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Active nav link state not showing #4

Open
DilsonsPickles opened this issue Oct 2, 2023 · 0 comments
Open

Active nav link state not showing #4

DilsonsPickles opened this issue Oct 2, 2023 · 0 comments

Comments

@DilsonsPickles
Copy link
Collaborator

DilsonsPickles commented Oct 2, 2023

Run locally the active nav link renders blue:
image

This doesn't appear to be happening in our staging environment.

function getUrlPath(url) { const parts = url.split("/"); return "/" + parts[parts.length - 1]; }

function renderNavLink(navLink, index) {
    return (
      <a
        href={navLink.href}
        target={navLink.target}
        key={index}
        className={
          getUrlPath(currentURL) === navLink.href
            ? "font-regular text-blue-700"
            : "font-regular text-gray-800 hover:text-blue-700"
        }
      >
        {navLink.linkText}
      </a>
    );
  }

Add console.log to above code to check what getUrlPath is returning on staging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant