-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
fix: include a left
class to navbar
#10843
base: main
Are you sure you want to change the base?
Conversation
Hi @wellwelwel! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
⚡️ Lighthouse report for the deploy preview of this PR
|
These classes are coming from Infima as a styling implementation detail. They are not meant to be used as a reliable way to select CSS elements. In the future, we may remove Infima, and use inline styling solutions instead, and your selectors will break. For example, we may introduce a Tailwind theme in the future, that won't have any of these 2 class names. I'm not fan of introducing an Infima-looking class that does nothing and is only meant to be used as a CSS selector. We have I'd prefer to introduce |
Thanks, @slorber! I really like this idea. It would be great to make it possible to dynamically add classes to navbar and its direct elements/items using the configuration file (similar to how it already works for navbar items). I'd like to illustrate an useful aspect from the developer's side before:
Resulting in: "OSI thinking": I brought this simple PR because I think it can be useful for developers who customize the style at a lower level (including more advanced levels using Please let me know what you think. Note I would like to contribute to the Portuguese (BR) translations in the future, which are quite outdated and also incomplete. So, I'll be here a few times yet 🙋🏻♂️ |
Feel free to modify this PR and add Adding classNames through the configuration file is more complicated, notably for the left/right containers because our current API doesn't really permit it, it would require a breaking change. Hardcoding 2 ThemeClassNames classes should be good enough and doesn't require to modify the API. |
Pre-flight checklist
Motivation
Currently, in a custom CSS, I can modify the direct navbar children by using selectors like
:first-child
for the left element, while I can select the right element using the.navbar__items--right
class.This PR improves DX by including the same approach/semantic for both left and right classes for direct children in navbar, improving the selectors' consistency.
Why
After this PR we'll be able to use both the current approach, as well as choosing a
navbar__items--left
class selector.Practical example:
⛓️💥 An extra motivation
If, for some reason, a new first element is added to navbar (for example, a non-visible element), the first approach will break, while the new one maintains a safe selectors' consistency.
Test Plan
Test links
Deploy preview: https://deploy-preview-10843--docusaurus-2.netlify.app/
Related issues/PRs