rturnq / solid-router

A router for solid-js
MIT License
42 stars 1 forks source link

NavLink activeClass doesn't work with hashIntegration #14

Closed ghost closed 3 years ago

ghost commented 3 years ago

Active classes aren't applied when used like this in hashIntegration:

<NavLink activeClass="bg-primary text-light" class="btn btn-link ml-2" href="">
    Dashboard
</NavLink>
<NavLink activeClass="bg-primary text-light" class="btn btn-link" href="monitor">
    Monitor
</NavLink>
<NavLink activeClass="bg-primary text-light" class="btn btn-link" href="deployed">
    Deployed
</NavLink>
<NavLink activeClass="bg-primary text-light" class="btn btn-link" href="integrations">
    Integrations
</NavLink>

this is at the root of the application so clicking monitor goes to /monitor but doesn't highlight the NavLink. I think this is happening because I am hosting the app like localhost:8080/web-app#/monitor

rturnq commented 3 years ago

Hmm, looks like the activeClass prop is always just being overwritten by the default class "is-active". It's just an oversight on the way I assign the default. I'll fix that.

rturnq commented 3 years ago

Whoops, didn't mean to close with that PR merge. Anyways, should be fixed now with v0.2.2.

rturnq commented 3 years ago

Also wanted to mention that in your example, you likely want to add the end prop to your dashboard NavLink so it only matches on the "/" path.

ghost commented 3 years ago

thanks, also thank you for publishing so fast

rturnq commented 3 years ago

You're welcome, thanks for the PR. Keep the issues coming.