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

docs: create NavLink cookbook example #5621

Merged
merged 15 commits into from
Dec 27, 2023
Merged

docs: create NavLink cookbook example #5621

merged 15 commits into from
Dec 27, 2023

Conversation

Adbib
Copy link
Contributor

@Adbib Adbib commented Dec 21, 2023

The NavLink component enhances navigation by getting isPending and isActive status to styling your links

Overview

What is it?

  • Feature / enhancement
  • Bug
  • Docs / tests / types / typos

Description

When building navigation in Qwik, you may want to know when a link is active or pending navigation. The standard and components don't provide this.

The NavLink component enhances navigation links by adding:

  • Active Status - Apply a class when the link matches the current location.
  • Pending Status - Apply a class during navigation when linking to the target location.

Use cases and why

    1. navbar
    1. sidebar

Checklist:

  • My code follows the developer guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • Added new tests to cover the fix / functionality

Sorry, something went wrong.

The NavLink component enhances navigation by getting isPending and isActive status to styling your links
Copy link

netlify bot commented Dec 21, 2023

👷 Deploy request for qwik-insights pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit c44c065

@Adbib Adbib mentioned this pull request Dec 21, 2023
7 tasks
Copy link
Member

@gioboa gioboa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to add the new section here.
packages/docs/src/routes/docs/menu.md
packages/docs/src/routes/docs/cookbook/index.mdx
Can you update this files too pls?

@gioboa gioboa changed the title create a page for NavLink component docs: create a page for NavLink component Dec 22, 2023
This was referenced Dec 22, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@gioboa
Copy link
Member

gioboa commented Dec 22, 2023

You need to add the new section here. packages/docs/src/routes/docs/menu.md packages/docs/src/routes/docs/cookbook/index.mdx Can you update this files too pls?

Can you do the change in this PR and not in a different one pls?

This was referenced Dec 22, 2023
@gioboa
Copy link
Member

gioboa commented Dec 22, 2023

@Adbib I fixed up the docs. I added my suggestions too.
Are we considering all the cases for isActiveprop?
what about href="/about/"
is it considered?

add checking the first slash in the link
@Adbib
Copy link
Contributor Author

Adbib commented Dec 22, 2023

@Adbib I fixed up the docs. I added my suggestions too. Are we considering all the cases for isActiveprop? what about href="/about/" is it considered?

yes is it

@Adbib Adbib requested a review from gioboa December 26, 2023 14:04
@gioboa
Copy link
Member

gioboa commented Dec 26, 2023

I added the CodeSandbox example and it doesn't seem to work and I can't understand how verify isPending 🤔
Screenshot 2023-12-26 at 17 26 54

@Adbib
Copy link
Contributor Author

Adbib commented Dec 26, 2023

I added the CodeSandbox example and it doesn't seem to work and I can't understand how verify isPending 🤔 Screenshot 2023-12-26 at 17 26 54

I think because we do a server-side and full-page refresh with a tag means that location.isNavigation will always return false.
if you try it with < Link > that does client-side navigation it should work

@gioboa
Copy link
Member

gioboa commented Dec 26, 2023

Can you verify the missing active and pending classes pls?
If your implementation is with Link you can change it

@Adbib
Copy link
Contributor Author

Adbib commented Dec 27, 2023

Can you verify the missing active and pending classes pls? If your implementation is with Link you can change it

its work now

@gioboa
Copy link
Member

gioboa commented Dec 27, 2023

I can't verify it now, can you send me a screenshot pls?

@Adbib
Copy link
Contributor Author

Adbib commented Dec 27, 2023

I can't verify it now, can you send me a screenshot pls?

this video with implementation of the same code :
https://github.com/BuilderIO/qwik/assets/17273701/61f42dec-578e-4174-8cea-00af5e2e2d06

@gioboa
Copy link
Member

gioboa commented Dec 27, 2023

@Adbib I cleaned up the example. I removed the pending state b/c I wasn't able to make it works.
If for you it's ok I will merge it.

@Adbib
Copy link
Contributor Author

Adbib commented Dec 27, 2023

@Adbib I cleaned up the example. I removed the pending state b/c I wasn't able to make it works. If for you it's ok I will merge it.

okay lets merge it for now untiil we find a way to pendding

@gioboa gioboa changed the title docs: create a page for NavLink component docs: create NavLink cookbook example Dec 27, 2023
@gioboa gioboa merged commit 20f1ea5 into QwikDev:main Dec 27, 2023
kodiakhq bot referenced this pull request in ascorbic/unpic-img Jan 7, 2024
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@builder.io/qwik](https://qwik.builder.io/) ([source](https://togithub.com/BuilderIO/qwik/tree/HEAD/packages/qwik)) | [`1.3.1` -> `1.3.2`](https://renovatebot.com/diffs/npm/@builder.io%2fqwik/1.3.1/1.3.2) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@builder.io%2fqwik/1.3.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@builder.io%2fqwik/1.3.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@builder.io%2fqwik/1.3.1/1.3.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@builder.io%2fqwik/1.3.1/1.3.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>BuilderIO/qwik (@&#8203;builder.io/qwik)</summary>

### [`v1.3.2`](https://togithub.com/BuilderIO/qwik/releases/tag/v1.3.2)

[Compare Source](https://togithub.com/BuilderIO/qwik/compare/v1.3.1...v1.3.2)

##### What's Changed

-   docs: update portal cookbook with solved problems by [@&#8203;thejackshelton](https://togithub.com/thejackshelton) in [https://github.com/BuilderIO/qwik/pull/5600](https://togithub.com/BuilderIO/qwik/pull/5600)
-   chore: Add notice about service worker usage by [@&#8203;nelsonprsousa](https://togithub.com/nelsonprsousa) in [https://github.com/BuilderIO/qwik/pull/5606](https://togithub.com/BuilderIO/qwik/pull/5606)
-   fix: Bun integration env.get is undefined by [@&#8203;phyrog](https://togithub.com/phyrog) in [https://github.com/BuilderIO/qwik/pull/5601](https://togithub.com/BuilderIO/qwik/pull/5601)
-   fix(insights): form errors by [@&#8203;mhevery](https://togithub.com/mhevery) in [https://github.com/BuilderIO/qwik/pull/5607](https://togithub.com/BuilderIO/qwik/pull/5607)
-   fix(qwik-insights): fix up create application form by [@&#8203;iamriajul](https://togithub.com/iamriajul) in [https://github.com/BuilderIO/qwik/pull/5573](https://togithub.com/BuilderIO/qwik/pull/5573)
-   docs(layout): Add "Slot" import by [@&#8203;HenriqueLimas](https://togithub.com/HenriqueLimas) in [https://github.com/BuilderIO/qwik/pull/5612](https://togithub.com/BuilderIO/qwik/pull/5612)
-   fix(tests): fix typos by [@&#8203;maiieul](https://togithub.com/maiieul) in [https://github.com/BuilderIO/qwik/pull/5616](https://togithub.com/BuilderIO/qwik/pull/5616)
-   fix: Correct qwik types by [@&#8203;mhevery](https://togithub.com/mhevery) in [https://github.com/BuilderIO/qwik/pull/5623](https://togithub.com/BuilderIO/qwik/pull/5623)
-   fix(docs): add missing cookbook section by [@&#8203;gioboa](https://togithub.com/gioboa) in [https://github.com/BuilderIO/qwik/pull/5626](https://togithub.com/BuilderIO/qwik/pull/5626)
-   fix(tailwind starter): switch from cjs to esm to support vite 5 by [@&#8203;thejackshelton](https://togithub.com/thejackshelton) in [https://github.com/BuilderIO/qwik/pull/5635](https://togithub.com/BuilderIO/qwik/pull/5635)
-   docs: fix up markdown rendering by [@&#8203;ValentinBossi](https://togithub.com/ValentinBossi) in [https://github.com/BuilderIO/qwik/pull/5532](https://togithub.com/BuilderIO/qwik/pull/5532)
-   refactor(insights): improve consistency  by [@&#8203;iamriajul](https://togithub.com/iamriajul) in [https://github.com/BuilderIO/qwik/pull/5609](https://togithub.com/BuilderIO/qwik/pull/5609)
-   docs: improve getting started steps by [@&#8203;shwosner](https://togithub.com/shwosner) in [https://github.com/BuilderIO/qwik/pull/5620](https://togithub.com/BuilderIO/qwik/pull/5620)
-   docs: improve eslint loader msg + add cookbook example by [@&#8203;gioboa](https://togithub.com/gioboa) in [https://github.com/BuilderIO/qwik/pull/5591](https://togithub.com/BuilderIO/qwik/pull/5591)
-   fix(ssr): slot subscribers by [@&#8203;wmertens](https://togithub.com/wmertens) in [https://github.com/BuilderIO/qwik/pull/5608](https://togithub.com/BuilderIO/qwik/pull/5608)
-   docs: create NavLink cookbook example by [@&#8203;Adbib](https://togithub.com/Adbib) in [https://github.com/BuilderIO/qwik/pull/5621](https://togithub.com/BuilderIO/qwik/pull/5621)
-   fix(tailwind): fix prettier config type by [@&#8203;shairez](https://togithub.com/shairez) in [https://github.com/BuilderIO/qwik/pull/5641](https://togithub.com/BuilderIO/qwik/pull/5641)
-   docs: add Node Docker deploy example by [@&#8203;nelsonprsousa](https://togithub.com/nelsonprsousa) in [https://github.com/BuilderIO/qwik/pull/5605](https://togithub.com/BuilderIO/qwik/pull/5605)
-   docs(cookbook): font optimization guide by [@&#8203;thejackshelton](https://togithub.com/thejackshelton) in [https://github.com/BuilderIO/qwik/pull/5645](https://togithub.com/BuilderIO/qwik/pull/5645)
-   fix: rendering ssr and csr for value="" by [@&#8203;wmertens](https://togithub.com/wmertens) in [https://github.com/BuilderIO/qwik/pull/5642](https://togithub.com/BuilderIO/qwik/pull/5642)
-   fix: remove unnecessary whitespace when handling classes by [@&#8203;jakovljevic-mladen](https://togithub.com/jakovljevic-mladen) in [https://github.com/BuilderIO/qwik/pull/5648](https://togithub.com/BuilderIO/qwik/pull/5648)
-   fix(jsx): dynamic DOM element props by [@&#8203;wmertens](https://togithub.com/wmertens) in [https://github.com/BuilderIO/qwik/pull/5650](https://togithub.com/BuilderIO/qwik/pull/5650)
-   refactor(jsx): tiny improvement by [@&#8203;wmertens](https://togithub.com/wmertens) in [https://github.com/BuilderIO/qwik/pull/5654](https://togithub.com/BuilderIO/qwik/pull/5654)
-   feat: add `skipConfirmation` to cli add command by [@&#8203;shairez](https://togithub.com/shairez) in [https://github.com/BuilderIO/qwik/pull/5655](https://togithub.com/BuilderIO/qwik/pull/5655)
-   chore: 1.3.2 by [@&#8203;shairez](https://togithub.com/shairez) in [https://github.com/BuilderIO/qwik/pull/5661](https://togithub.com/BuilderIO/qwik/pull/5661)

##### New Contributors

-   [@&#8203;phyrog](https://togithub.com/phyrog) made their first contribution in [https://github.com/BuilderIO/qwik/pull/5601](https://togithub.com/BuilderIO/qwik/pull/5601)
-   [@&#8203;HenriqueLimas](https://togithub.com/HenriqueLimas) made their first contribution in [https://github.com/BuilderIO/qwik/pull/5612](https://togithub.com/BuilderIO/qwik/pull/5612)
-   [@&#8203;ValentinBossi](https://togithub.com/ValentinBossi) made their first contribution in [https://github.com/BuilderIO/qwik/pull/5532](https://togithub.com/BuilderIO/qwik/pull/5532)
-   [@&#8203;shwosner](https://togithub.com/shwosner) made their first contribution in [https://github.com/BuilderIO/qwik/pull/5620](https://togithub.com/BuilderIO/qwik/pull/5620)

**Full Changelog**: QwikDev/qwik@v1.3.1...v1.3.2

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 9pm on sunday" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/ascorbic/unpic-img).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMjEuMCIsInVwZGF0ZWRJblZlciI6IjM3LjEyMS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->
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

Successfully merging this pull request may close these issues.

None yet

2 participants