-
Notifications
You must be signed in to change notification settings - Fork 30
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 links #2
Comments
Thanks! My proposal is something like this: <script>
import {active} from 'tinro';
</script>
<a href="/some/internal/path" use:active>Link</a> The problems that we should solve here:
By default, class will be Variant1: <a href="/some/path" use:active>Link</a>
<a href="/some/path" use:active={{exact:true}}>Link</a>
<a href="/some/path" use:active={{class:'customclass',exact:true}}>Link</a> Variant2: <a href="/some/path" use:active>Link</a>
<a href="/some/path" use:active data-exact>Link</a>
<a href="/some/path" use:active data-exact data-class="customclass">Link</a> Variant3: <script>
import {active,activeExact} from 'tinro';
</script>
<a href="/some/path" use:active>Link</a>
<a href="/some/path" use:activeExact>Link</a>
<a href="/some/path" use:activeExact={'customclass'}>Link</a> I like |
I kinda like variant 3 the least haha, 2 different things to import, seems a bit inconsistent. But any of these variants are better than nothing :D |
Nothing of three is ideal, as for me. Will wait some time. Maybe somebody will suggest a better way for this feature implementation. |
Just seen - I mean my prefered Variant is 2, not 3 =) It is most declarative. |
Just released active action. Please check v0.2.2 on NPM, and see Readme for more info |
What is the solution for the active class in 2022. Also, would you mind letting me know if I'm doing something wrong here, this code does not work <a use:active exact href="/example">Example link</a>
<style lang="postcss">
.active {
@apply border-primary border-b-2;
}
</style> |
Very cool tiny router! Especially love the fallback handling that bubbles up to parent routes.
One thing that seems to be missing though is support for detecting / styling active links. Have you thought about adding that to tinro?
The text was updated successfully, but these errors were encountered: