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

Add example of dark navbar and offcanvas to docs #36510

Merged
merged 6 commits into from Jun 15, 2022
Merged

Conversation

mdo
Copy link
Member

@mdo mdo commented Jun 6, 2022

Closes #34685.

We don't show folks currently any example of a dark navbar and offcanvas. This PR adds one in hopes of better demonstrating that additional changes are necessary at the moment for them to work correctly. I hope this can be improved with dark mode theming where we can change the colors on components with data-theme. In the meantime, some overrides are necessary.

@mdo mdo added this to In progress in v5.2.0-stable via automation Jun 6, 2022
Copy link
Member

@julien-deramond julien-deramond left a comment

Choose a reason for hiding this comment

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

Good addition to the documentation!

Just wondering if the dark offcanvas shouldn't be detailed in "Offcanvas > Dark offcanvases" (as it is done for the Dark dropdowns) and then in the dark navbar description explain that it uses this dark offcanvas (and keep the reusable code in the doc).

site/content/docs/5.2/components/navbar.md Outdated Show resolved Hide resolved
site/content/docs/5.2/components/navbar.md Outdated Show resolved Hide resolved
site/content/docs/5.2/components/navbar.md Outdated Show resolved Hide resolved
@julien-deramond
Copy link
Member

Before accepting the PR what do you think about creating "Offcanvas > Dark offcanvases" and then in the dark navbar description explaining that it uses this dark offcanvas (and keep the reusable code in the doc)?

@mdo mdo force-pushed the docs-navbar-offcanvas-dark branch from d790cc8 to cfb72ec Compare June 14, 2022 16:21
@mdo mdo requested a review from a team as a code owner June 14, 2022 16:21
@mdo
Copy link
Member Author

mdo commented Jun 14, 2022

@julien-deramond Should be good now!

Copy link
Member

@julien-deramond julien-deramond left a comment

Choose a reason for hiding this comment

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

LGTM! I just proposed some ideas to tweak the descriptions. Feel free to modify the PR if you think it is better. Otherwise you can merge it as is.

@@ -79,6 +79,22 @@ You can use a link with the `href` attribute, or a button with the `data-bs-targ
</div>
{{< /example >}}

### Dark offcanvas

Change the appearance of offcanvases with utilities to better match them to different contexts like dark navbars. Here we add `.text-bg-dark` to the `.offcanvas` and `.btn-close-white` to `.btn-close` for proper styling with a dark offcanvas. If you have dropdowns within, consider also adding `.dropdown-menu-dark` to `.dropdown-menu`.
Copy link
Member

Choose a reason for hiding this comment

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

I'd have removed the last sentence. More generally in a dark component content, we should use dark variants of components.
It's OK to talk about .text-bg-dark and .btn-close-white because it is part of the offcanvas' structure, but the dropdown would be used only to fill the content.

@@ -732,6 +732,52 @@ To create an offcanvas navbar that expands into a normal navbar at a specific br
</nav>
```

When using offcanvas in a dark navbar, be aware that you may need to have a dark background on the offcanvas content to avoid the text becoming illegible. In the example below, we add `.navbar-dark` and `.bg-dark` to the `.navbar`, `.text-bg-dark` to the `.offcanvas`, `.dropdown-menu-dark` to `.dropdown-menu`, and `.btn-close-white` to `.btn-close` for proper styling with a dark offcanvas.
Copy link
Member

Choose a reason for hiding this comment

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

Proposition of enhancement. I would have used a direct link to the Dark variant of the offcanvas rather than explaining how it is built.

⚠️ on my phone so I've not tested the following Markdown link format

Suggested change
When using offcanvas in a dark navbar, be aware that you may need to have a dark background on the offcanvas content to avoid the text becoming illegible. In the example below, we add `.navbar-dark` and `.bg-dark` to the `.navbar`, `.text-bg-dark` to the `.offcanvas`, `.dropdown-menu-dark` to `.dropdown-menu`, and `.btn-close-white` to `.btn-close` for proper styling with a dark offcanvas.
When using offcanvas in a dark navbar, be aware that you may need to have a dark background on the offcanvas content to avoid the text becoming illegible. In the example below, we add `.navbar-dark` and `.bg-dark` to the `.navbar`, `.dropdown-menu-dark` to `.dropdown-menu`, and use a [Dark offcanvas]({{< docsref "/components/offcanvas/#dark-offcanvas" >}})`.

v5.2.0-stable automation moved this from In progress to Reviewer approved Jun 15, 2022
@mdo mdo merged commit 24d79fe into main Jun 15, 2022
v5.2.0-stable automation moved this from Reviewer approved to Done Jun 15, 2022
@mdo mdo deleted the docs-navbar-offcanvas-dark branch June 15, 2022 14:41
@mdo
Copy link
Member Author

mdo commented Jun 15, 2022

Oops! Didn't read on mobile before merging 😅. I'll do another PR to address the comments :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
v5.2.0-stable
  
Done
Status: Done
Development

Successfully merging this pull request may close these issues.

v5: navbar-offcanvas color issues with navbar-dark
2 participants