docusaurus icon indicating copy to clipboard operation
docusaurus copied to clipboard

feat: allow activeBaseRegex for DocNavbarItem

Open juliusmarminge opened this issue 3 years ago • 3 comments

Pre-flight checklist

  • [x] I have read the Contributing Guidelines on pull requests.
  • [ ] If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
  • [x] If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

Motivation

DocNavbarItem's currently aren't allowed being matched using activeBasePath or activeBaseRegex like other NavbarItems. This PR adds the ability to match these too.

For reference, on the tRPC website, we have multiple DocItems in the navbar, and currently they are all being matched as active. By allowing them to be regex matched we would have more flexibility and could fix this issue.

Test Plan

I don't think there is any need for tests. I have reused the same logic from NavbarNavLink. If you disagree, let me know and we can work it out.

Test links

  • NaN

Deploy preview: https://deploy-preview-_____--docusaurus-2.netlify.app/

Related issues/PRs

Closes #8018

juliusmarminge avatar Sep 10 '22 20:09 juliusmarminge

[V2]

Built without sensitive environment variables

Name Link
Latest commit 8e5a75fcbbbfafe56501185b7a64a078ed6cecd1
Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/631cf550026c860009217da8
Deploy Preview https://deploy-preview-8079--docusaurus-2.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

netlify[bot] avatar Sep 10 '22 20:09 netlify[bot]

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO PWA Report
/ 🟠 83 🟢 98 🟢 100 🟢 100 🟠 80 Report
/docs/installation 🟠 81 🟢 100 🟢 100 🟢 100 🟢 90 Report

github-actions[bot] avatar Sep 10 '22 20:09 github-actions[bot]

[V2]

Built without sensitive environment variables

Name Link
Latest commit c29870f11c4714591c5ee48465f91cc7d06d68b5
Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/631cf645cddb94000c325883
Deploy Preview https://deploy-preview-8079--docusaurus-2.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

netlify[bot] avatar Sep 10 '22 20:09 netlify[bot]