Skip to content

Active nav link state not showing #4

Description

@DilsonsPickles

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions