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 state for navigation object #159

Open
eikaramba opened this issue May 20, 2022 · 1 comment
Open

Active state for navigation object #159

eikaramba opened this issue May 20, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@eikaramba
Copy link

Action Performed:

navigate page

Expected Result:

active state of navigation object should change

Actual Result:

active is always false and only visible in the homepage

grafik

Workaround:

nothing i am aware of

Platform:

Where is this issue occurring?

  • Primo Desktop
  • Primo Server
  • Misc (website, Try Primo, etc)

Version Number:
desktop 0.4.1

@mateomorris
Copy link
Collaborator

Thanks for pointing this out. That's actually a bit of functionality I'd started implementing but never finished because I found a way to do it with JS:

HTML:
<a href={link.url} class="link" class:active={isActive(link.url)}>{link.label}</a>

JS:

function isActive(url) {
  const page = window.location.pathname
  if (page === url) return true
  else if (page === '' && url === '/') return true // home
}

(note it only works on the published site & not within primo)

I'll take active out for now but leave the issue open as a feature request since it would be ideal to do this statically.

@mateomorris mateomorris added the enhancement New feature or request label May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants