Skip to content

Commit

Permalink
Merge pull request #125 from CityOfDetroit/fix.nav.122.1
Browse files Browse the repository at this point in the history
Use BS nav classes to set offcanvas nav direction
  • Loading branch information
jedgar1mx authored Dec 5, 2023
2 parents 7e037d6 + 3f6fe6a commit 17ba4a1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/components/atoms/OffcanvasBody/OffcanvasBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ export default class OffcanvasBody extends HTMLElement {
this.shadowRoot.addEventListener('slotchange', () => {
const tempElements = Array.from(this.children);
tempElements.forEach((node) => {
if (node.tagName === 'COD-NAV') {
node.setAttribute('data-extra-classes', 'navbar-nav');
}
this.body.append(node);
});
});
Expand Down
5 changes: 5 additions & 0 deletions src/components/molecules/Nav/Nav.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
.nav-item {
font-family: var(--font-family);
}

.navbar-nav .nav-link {
--bs-nav-link-padding-x: 0.75em;
--bs-btn-padding-x: var(--bs-nav-link-padding-x);
}
4 changes: 2 additions & 2 deletions src/stories/navbar.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ export const Offcanvas = () => html`
<h5>Offcanvas</h5>
</cod-offcanvas-header>
<cod-offcanvas-body>
<cod-nav data-vertical="true">
<cod-nav>
<a class="nav-link active" aria-current="page" href="#">Home</a>
<a class="nav-link" href="#">Link</a>
<cod-dropdown data-split="false">
Expand Down Expand Up @@ -511,7 +511,7 @@ export const OffcanvasColor = () => html`
<h5>Offcanvas</h5>
</cod-offcanvas-header>
<cod-offcanvas-body data-extra-classes="bg-dark">
<cod-nav data-vertical="true" data-extra-classes="text-light">
<cod-nav data-extra-classes="text-light">
<a class="nav-link active text-light" aria-current="page" href="#"
>Home</a
>
Expand Down

0 comments on commit 17ba4a1

Please sign in to comment.